Part Number Hot Search : 
TA7240 PM6675S C5000 1755765 VN2204N3 0100C P60N06 GL256N
Product Description
Full Text Search
 

To Download CY8C22213-24PVIT Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  cy8c22113, cy8c22213 psoc? mixed signal array preliminary data sheet for silicon revision a december 22, 2003 cypress microsystems 2700 162nd street sw building d lynnwood, wa 98037 phone: 800.669.0557 fax: 425.787.4641 http://www.cypress.com document no. 38-12009 rev. *d
2 document no. 38-12009 rev. *d december 22, 2003 cy8c22xxx preliminary data sheet ? cypress microsystems, inc. 2003. all rights reserved. psoc? (programmable system-on-chip?) is a trademark of cypress microsystems, inc. all other trademarks or registered trademarks referenced herein are property of the respective corporations. the information contained herein is subject to change without notice. cypress microsystems assumes no responsibility for the use of any circuitry other than circuitry embodied in a cypress microsystems product. nor does it convey or imply any license under patent or other rights. cypress microsystems does not authorize its products for use as critical components in life support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. the inclusion of cypress microsystems? products in life-support system applications implies that the manufacturer assumes all risk of such use and in doing so, indemnifies cypress microsystems against all charges.
december 22, 2003 document no. 38-12009 rev. *d 3 contents section a overview 13 features ...................................................................................................................... .....................13 getting started ............................................................................................................... ..................14 development kits .............................................................................................................. ..14 tele-training ................................................................................................................. ......14 consultants ................................................................................................................... ......14 technical support ............................................................................................................. ..14 application notes ............................................................................................................. ...14 top-level architecture ........................................................................................................ .............15 development tools ............................................................................................................. .............16 psoc designer software subsystems ................................................................................16 hardware tools ................................................................................................................ ...17 user modules and development process ........................................................................................17 ordering information .......................................................................................................... ..............19 organization and conventions .................................................................................................. .......20 document organization ......................................................................................................20 document conventions .......................................................................................................20 1. pin information .......................................................................................................23 1.1 pin summary ................................................................................................................ .......23 1.2 pinouts ..................................................................................................................... ............24 2. packaging information ............................................................................................27 2.1 packaging dimensions........................................................................................................ .27 2.2 thermal impedances ......................................................................................................... .30 section b core architecture 31 top-level core architecture ................................................................................................... .........31 core register summary ......................................................................................................... ..........32 3. cpu core (m8c) ....................................................................................................35 3.1 internal registers .......................................................................................................... .......35 3.2 address spaces .............................................................................................................. .....35 3.3 instruction set summary..................................................................................................... .37 3.4 instruction format .......................................................................................................... ......38 3.4.1 one-byte instructions.....................................................................................38 3.4.2 two-byte instructions.....................................................................................38 3.4.3 three-byte instructions ..................................................................................39 3.5 addressing modes ............................................................................................................ ...39 3.5.1 source immediate ..........................................................................................39
contents cy8c22xxx preliminary data sheet 4 document no. 38-12009 rev. *d december 22, 2003 3.5.2 source direct .................................................................................................40 3.5.3 source indexed..............................................................................................40 3.5.4 destination direct...........................................................................................40 3.5.5 destination indexed .......................................................................................41 3.5.6 destination direct source immediate ............................................................41 3.5.7 destination indexed source immediate .........................................................41 3.5.8 destination direct source direct....................................................................42 3.5.9 source indirect post increment......................................................................42 3.5.10 destination indirect post increment ...............................................................42 3.6 register definitions........................................................................................................ ......43 3.6.1 cpu_f (flag) register ..................................................................................43 4. supervisory rom (srom) ...................................................................................... 45 4.1 architectural description ................................................................................................... ...45 4.1.1 additional srom feature ..............................................................................46 4.1.2 srom function descriptions.........................................................................46 4.2 register definitions........................................................................................................ ......49 4.2.1 cpu_scr1 register .....................................................................................49 4.3 clocking .................................................................................................................... ...........49 5. interrupt controller ................................................................................................. 51 5.1 architectural description ................................................................................................... ...52 5.2 register definitions........................................................................................................ ......53 5.2.1 int_clrx register........................................................................................53 5.2.2 int_mskx register .......................................................................................53 5.2.3 int_vc register............................................................................................53 5.2.4 cpu_f register.............................................................................................53 6. general purpose io (gpio) .................................................................................... 55 6.1 architectural description ................................................................................................... ...55 6.1.1 digital io ........................................................................................................55 6.1.2 global io........................................................................................................55 6.1.3 analog io .......................................................................................................56 6.1.4 gpio block interrupts ....................................................................................56 6.2 register definitions........................................................................................................ ......58 6.2.1 prtxdr registers.........................................................................................58 6.2.2 prtxie registers ..........................................................................................58 6.2.3 prtxgs registers.........................................................................................58 6.2.4 prtxdmx registers ......................................................................................58 6.2.5 prtxicx registers ........................................................................................59 7. analog output drivers ............................................................................................ 61 7.1 architectural description ................................................................................................... ...61 7.2 register definitions........................................................................................................ ......61 7.2.1 abf_cr0 register ........................................................................................61 8. internal main oscillator (imo) ................................................................................. 63 8.1 architectural description ................................................................................................... ...63 8.2 register definitions........................................................................................................ ......63 8.2.1 imo_tr register ...........................................................................................63
december 22, 2003 document no. 38-12009 rev. *d 5 cy8c22xxx preliminary data sheet contents 9. internal low speed oscillator (ilo) ........................................................................65 9.1 architectural description ................................................................................................... ...65 9.2 register definitions ........................................................................................................ ......65 9.2.1 ilo_tr register ............................................................................................65 10. 32 khz crystal oscillator (eco) ..............................................................................67 10.1 architectural description .................................................................................................. ....67 10.1.1 eco external components............................................................................68 10.2 register definitions ....................................................................................................... .......68 10.2.1 osc_cr0 register........................................................................................68 10.2.2 eco_tr register ..........................................................................................69 10.2.3 cpu_scr1 register......................................................................................69 11. phase locked loop (pll) .......................................................................................71 11.1 architectural description .................................................................................................. ....71 11.2 register definitions ....................................................................................................... .......71 11.2.1 osc_cr0 register........................................................................................71 11.2.2 osc_cr2 register........................................................................................72 12. sleep and watchdog ..............................................................................................73 12.1 architectural description .................................................................................................. ....73 12.1.1 32 khz clock selection ..................................................................................73 12.1.2 sleep timer ....................................................................................................74 12.1.3 sleep bit.........................................................................................................74 12.2 application description.................................................................................................... .....74 12.3 register definitions ....................................................................................................... .......75 12.3.1 int_msk0 register .......................................................................................75 12.3.2 res_wdt register .......................................................................................75 12.3.3 osc_cr0 register........................................................................................75 12.3.4 cpu_scr1 register......................................................................................76 12.3.5 ilo_tr register ............................................................................................76 12.3.6 eco_tr register ..........................................................................................76 12.3.7 cpu_scr0 register......................................................................................76 12.4 timing diagrams ............................................................................................................ ......77 12.4.1 sleep sequence.............................................................................................77 12.4.2 wake up sequence .......................................................................................78 12.4.3 bandgap refresh ...........................................................................................79 12.4.4 watchdog timer (wdt) .................................................................................79 12.5 power consumption.......................................................................................................... ...80 section c register reference 81 register conventions .......................................................................................................... .............81 register mapping tables ....................................................................................................... ..........81 register map 0 table: user space ..............................................................................82 register map 1 table: configuration space ................................................................83 13. register details ......................................................................................................85 13.1 bank 0 registers........................................................................................................... .......86 13.1.1 prtxdr ........................................................................................................86 13.1.2 prtxie ..........................................................................................................87 13.1.3 prtxgs ........................................................................................................88
contents cy8c22xxx preliminary data sheet 6 document no. 38-12009 rev. *d december 22, 2003 13.1.4 prtxdm2 .....................................................................................................89 13.1.5 dxbxxdr0 ....................................................................................................90 13.1.6 dxbxxdr1 ....................................................................................................91 13.1.7 dxbxxdr2 ....................................................................................................92 13.1.8 dxbxxcr0 ....................................................................................................93 13.1.9 dxbxxcr0 ....................................................................................................94 13.1.10 dxbxxcr0 ....................................................................................................95 13.1.11 dxbxxcr0 ....................................................................................................96 13.1.12 dcbxxcr0 ....................................................................................................97 13.1.13 dcbxxcr0 ....................................................................................................98 13.1.14 dcbxxcr0 ....................................................................................................99 13.1.15 dcbxxcr0 ..................................................................................................100 13.1.16 amx_in ......................................................................................................101 13.1.17 arf_cr .....................................................................................................102 13.1.18 cmp_cr0 ...................................................................................................103 13.1.19 asy_cr .....................................................................................................104 13.1.20 cmp_cr1 ...................................................................................................105 13.1.21 acbxxcr3 ..................................................................................................106 13.1.22 acbxxcr0 ..................................................................................................107 13.1.23 acbxxcr1 ..................................................................................................108 13.1.24 acbxxcr2 ..................................................................................................109 13.1.25 ascxxcr0 ..................................................................................................110 13.1.26 ascxxcr1 ..................................................................................................111 13.1.27 ascxxcr2 ..................................................................................................112 13.1.28 ascxxcr3 ..................................................................................................113 13.1.29 asdxxcr0 ..................................................................................................114 13.1.30 asdxxcr1 ..................................................................................................115 13.1.31 asdxxcr2 ..................................................................................................116 13.1.32 asdxxcr3 ..................................................................................................117 13.1.33 rdixri ........................................................................................................118 13.1.34 rdixsyn ....................................................................................................119 13.1.35 rdixis ........................................................................................................120 13.1.36 rdixlt0 ......................................................................................................121 13.1.37 rdixlt1 ......................................................................................................122 13.1.38 rdixro0 ...................................................................................................123 13.1.39 rdixro1 ....................................................................................................124 13.1.40 i2c_cfg .....................................................................................................125 13.1.41 i2c_scr .....................................................................................................126 13.1.42 i2c_dr .......................................................................................................127 13.1.43 i2c_mscr ..................................................................................................128 13.1.44 int_clr0 ...................................................................................................129 13.1.45 int_clr1 ...................................................................................................131 13.1.46 int_clr3 ...................................................................................................132 13.1.47 int_msk3 ..................................................................................................133 13.1.48 int_msk0 ..................................................................................................134 13.1.49 int_msk1 ..................................................................................................135 13.1.50 int_vc .......................................................................................................136 13.1.51 res_wdt ..................................................................................................137 13.1.52 dec_dh .....................................................................................................138 13.1.53 dec_dl ......................................................................................................139 13.1.54 dec_cr0 ...................................................................................................140 13.1.55 dec_cr1 ...................................................................................................141 13.1.56 cpu_f ........................................................................................................142 13.1.57 cpu_scr1 .................................................................................................143
december 22, 2003 document no. 38-12009 rev. *d 7 cy8c22xxx preliminary data sheet contents 13.1.58 cpu_scr0 .................................................................................................144 13.2 bank 1 registers........................................................................................................... .....145 13.2.1 prtxdm0 ....................................................................................................145 13.2.2 prtxdm1 ....................................................................................................146 13.2.3 prtxic0 ......................................................................................................147 13.2.4 prtxic1 ......................................................................................................148 13.2.5 dxbxxfn .....................................................................................................149 13.2.6 dxbxxin ......................................................................................................151 13.2.7 dxbxxou ....................................................................................................152 13.2.8 clk_cr0 ....................................................................................................154 13.2.9 clk_cr1 ....................................................................................................155 13.2.10 abf_cr0 ....................................................................................................156 13.2.11 amd_cr1 .................................................................................................157 13.2.12 alt_cr0 ....................................................................................................158 13.2.13 gdi_o_in ...................................................................................................159 13.2.14 gdi_e_in ....................................................................................................160 13.2.15 gdi_o_ou ..................................................................................................161 13.2.16 gdi_e_ou ..................................................................................................162 13.2.17 osc_cr4 ...................................................................................................163 13.2.18 osc_cr3 ...................................................................................................164 13.2.19 osc_cr0 ...................................................................................................165 13.2.20 osc_cr1 ...................................................................................................166 13.2.21 osc_cr2 ...................................................................................................167 13.2.22 vlt_cr ......................................................................................................168 13.2.23 vlt_cmp ....................................................................................................169 13.2.24 imo_tr .......................................................................................................170 13.2.25 ilo_tr ........................................................................................................171 13.2.26 bdg_tr ......................................................................................................172 13.2.27 eco_tr ......................................................................................................173 section d digital system 175 top-level digital architecture ................................................................................................ ........175 digital register summary ...................................................................................................... ........176 14. global digital interconnect (gdi) ..........................................................................177 14.1 architectural description .................................................................................................. ..177 14.2 register definitions ....................................................................................................... .....179 14.2.1 gdi_o_in and gdi_e_in registers............................................................179 14.2.2 gdi_o_ou and gdi_e_ou registers ........................................................179 15. array digital interconnect (adi) ............................................................................181 15.1 architectural description .................................................................................................. ..181 16. row digital interconnect (rdi) ..............................................................................183 16.1 architectural description .................................................................................................. ..183 16.2 register definitions ....................................................................................................... .....186 16.2.1 rdixri register ...........................................................................................186 16.2.2 rdixsyn register .......................................................................................186 16.2.3 rdixis register ...........................................................................................186 16.2.4 rdixltx registers .......................................................................................187 16.2.5 rdixrox registers......................................................................................187 16.3 timing diagram ............................................................................................................ .....187
contents cy8c22xxx preliminary data sheet 8 document no. 38-12009 rev. *d december 22, 2003 17. digital blocks ....................................................................................................... 189 17.1 architectural description .................................................................................................. ..189 17.1.1 input multiplexers.........................................................................................189 17.1.2 input clock resynchronization ....................................................................190 17.1.3 output de-multiplexers ................................................................................191 17.1.4 block chaining signals ................................................................................191 17.1.5 timer function .............................................................................................192 17.1.6 counter function .........................................................................................192 17.1.7 dead band function ....................................................................................193 17.1.8 crcprs function .......................................................................................194 17.1.9 spi protocol function ..................................................................................195 17.1.10 spi master function ....................................................................................196 17.1.11 spi slave function ......................................................................................196 17.1.12 asynchronous transmitter function ............................................................197 17.1.13 asynchronous receiver function ................................................................197 17.2 register definitions....................................................................................................... .....198 17.2.1 dxbxxdrx registers ...................................................................................198 17.2.2 dxbxxcr0 register .....................................................................................203 17.2.3 int_msk1 register .....................................................................................203 17.2.4 dxbxxfn registers......................................................................................203 17.2.5 dxbxxin registers.......................................................................................204 17.2.6 dxbxxou registers .....................................................................................204 17.3 timing diagrams............................................................................................................ ....204 17.3.1 timer timing ................................................................................................205 17.3.2 counter timing ............................................................................................206 17.3.3 dead band timing .......................................................................................206 17.3.4 crcprs timing ..........................................................................................208 17.3.5 spi mode timing .........................................................................................208 17.3.6 spim timing ................................................................................................209 17.3.7 spis timing .................................................................................................212 17.3.8 transmitter timing .......................................................................................215 17.3.9 receiver timing ...........................................................................................216 section e analog system 219 top-level analog architecture ................................................................................................. .....219 analog register summary ....................................................................................................... ......221 18. analog interface ................................................................................................... 223 18.1 architectural description .................................................................................................. ..223 18.1.1 analog data bus interface ...........................................................................223 18.1.2 analog comparator bus interface................................................................223 18.1.3 analog column clock generation................................................................225 18.1.4 decimator and incremental adc interface ..................................................226 18.1.5 analog modulator interface (mod bits) ........................................................226 18.1.6 analog synchronization interface (stalling) .................................................226 18.1.7 sar hardware acceleration ........................................................................226 18.2 register definitions....................................................................................................... .....228 18.2.1 cmp_cr0 register .....................................................................................228 18.2.2 cmp_cr1 register .....................................................................................228 18.2.3 asy_cr register ........................................................................................228 18.2.4 dec_cr0 register......................................................................................229 18.2.5 dec_cr1 register......................................................................................229 18.2.6 clk_cr0 register ......................................................................................230
december 22, 2003 document no. 38-12009 rev. *d 9 cy8c22xxx preliminary data sheet contents 18.2.7 clk_cr1 register.......................................................................................230 18.2.8 amd_cr1 register......................................................................................230 18.2.9 alt_cr0 register .......................................................................................230 19. analog array ........................................................................................................231 19.1 architectural description .................................................................................................. ..231 19.1.1 analog comparator bus...............................................................................233 19.2 temperature sensing capability........................................................................................233 20. analog input configuration ...................................................................................235 20.1 register definitions ....................................................................................................... .....235 20.1.1 amx_in register .........................................................................................235 20.1.2 abf_cr0 register.......................................................................................235 20.2 architectural description .................................................................................................. ..236 21. analog reference .................................................................................................237 21.1 architectural description .................................................................................................. ..237 21.2 register definitions ....................................................................................................... .....238 21.2.1 arf_cr register ........................................................................................238 22. switched capacitor block .....................................................................................239 22.1 architectural description ................................................................................................. ..240 22.2 application description.................................................................................................... ...241 22.3 register definitions ....................................................................................................... .....241 22.3.1 ascxxcr0 register.....................................................................................242 22.3.2 ascxxcr1 register.....................................................................................242 22.3.3 ascxxcr2 register.....................................................................................242 22.3.4 ascxxcr3 register.....................................................................................243 22.3.5 asdxxcr0 register.....................................................................................243 22.3.6 asdxxcr1 register.....................................................................................243 22.3.7 asdxxcr2 register.....................................................................................243 22.3.8 asdxxcr3 register.....................................................................................244 23. continuous time block .........................................................................................245 23.1 architectural description .................................................................................................. ..245 23.2 register definitions ....................................................................................................... .....247 23.2.1 acbxxcr0 register.....................................................................................247 23.2.2 acbxxcr1 register.....................................................................................247 23.2.3 acbxxcr2 register.....................................................................................247 23.2.4 acbxxcr3 register.....................................................................................247 section f system resources 251 top-level system resources architecture ....................................................................................251 system resources register summary ..........................................................................................252 24. digital clocks .......................................................................................................253 24.1 architectural description .................................................................................................. ..253 24.1.1 internal main oscillator ................................................................................253 24.1.2 internal low speed oscillator ......................................................................254 24.1.3 32 khz crystal oscillator..............................................................................254
contents cy8c22xxx preliminary data sheet 10 document no. 38-12009 rev. *d december 22, 2003 24.1.4 external clock..............................................................................................254 24.2 register definitions....................................................................................................... .....256 24.2.1 int_clr0 register......................................................................................256 24.2.2 int_msk0 register .....................................................................................256 24.2.3 osc_cr0 register......................................................................................256 24.2.4 osc_cr1 register......................................................................................257 24.2.5 osc_cr2 register......................................................................................257 24.2.6 osc_cr3 register......................................................................................258 24.2.7 osc_cr4 register......................................................................................258 25. decimator ............................................................................................................ 259 25.1 architectural description .................................................................................................. ..259 25.2 register definitions....................................................................................................... .....259 25.2.1 dec_dh register........................................................................................259 25.2.2 dec_dl register ........................................................................................260 25.2.3 dec_cr0 register......................................................................................260 25.2.4 dec_cr1 register......................................................................................260 26. i2c ....................................................................................................................... 261 26.1 architectural description .................................................................................................. ..261 26.1.1 basic i2c data transfer...............................................................................261 26.2 application description .................................................................................................... ..263 26.2.1 slave operation ...........................................................................................263 26.2.2 master operation .........................................................................................264 26.3 register definitions....................................................................................................... .....265 26.3.1 i2c_cfg register .......................................................................................265 26.3.2 i2c_scr register .......................................................................................267 26.3.3 i2c_dr register..........................................................................................269 26.3.4 i2c_mscr register ....................................................................................269 26.4 timing diagrams............................................................................................................ ....270 26.4.1 clock generation .........................................................................................270 26.4.2 enable and command synchronization.......................................................271 26.4.3 basic input/output timing............................................................................271 26.4.4 status timing ...............................................................................................272 26.4.5 master start timing ......................................................................................273 26.4.6 master restart timing .................................................................................274 26.4.7 master stop timing ......................................................................................274 26.4.8 master/slave stall timing ............................................................................275 26.4.9 master lost arbitration timing .....................................................................275 26.4.10 master clock synchronization .....................................................................276 27. por and lvd ...................................................................................................... 277 27.1 architectural description .................................................................................................. ..277 27.2 register definitions....................................................................................................... .....277 27.2.1 vlt_cr register .........................................................................................277 27.2.2 vlt_cmp register ......................................................................................277 28. internal voltage reference ................................................................................... 279 28.1 architectural description .................................................................................................. ..279 28.2 register definitions....................................................................................................... .....279 28.2.1 bdg_tr register ........................................................................................279
december 22, 2003 document no. 38-12009 rev. *d 11 cy8c22xxx preliminary data sheet contents 29. system resets .....................................................................................................281 29.1 register definitions ....................................................................................................... .....281 29.1.1 cpu_scr0 register....................................................................................281 29.1.2 cpu_scr1 register....................................................................................282 29.2 timing diagrams ............................................................................................................ ....282 29.2.1 power on reset (por)................................................................................282 29.2.2 external reset (xres) ................................................................................282 29.2.3 watchdog timer reset (wdr).....................................................................282 29.2.4 reset details ................................................................................................284 29.3 power consumption.......................................................................................................... .285 section g electrical specifications 287 absolute maximum ratings .................................................................................................... .....288 operating temperature ....................................................................................................... .........288 dc electrical characteristics ................................................................................................. .........289 dc chip-level specifications ............................................................................................289 dc general purpose io (gpio) specifications ................................................................289 dc operational amplifier specifications ...........................................................................290 dc analog output buffer specifications ...........................................................................292 dc analog reference specifications ................................................................................293 dc analog psoc block specifications .............................................................................293 dc por and lvd specifications ......................................................................................294 dc programming specifications .......................................................................................295 ac electrical characteristics ................................................................................................. .........296 ac chip-level specifications ............................................................................................296 ac general purpose io (gpio) specifications .................................................................296 ac operational amplifier specifications ...........................................................................297 ac digital block specifications .........................................................................................299 ac analog output buffer specifications ...........................................................................300 ac external clock specifications ......................................................................................301 ac programming specifications .......................................................................................301 ac i2c specifications .......................................................................................................30 2 section h revision history 303
contents cy8c22xxx preliminary data sheet 12 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 13 section a overview the psoc? family consists of many mixed signal array with on-chip controller devices. these devices are designed to replace multiple traditional mcu-based system components with one, low cost single-chip programmable component. a psoc device includes configurable blocks of analog and digital logic, as well as programmable interconnect. this architecture allows the user to create customized peripheral configurations, to match the requirements of each individual application. addi- tionally, a fast cpu, flash program memory, sram data memory, and configurable io are included in a range of convenient pin-outs. the overview section discusses the features, getting started, top-level architecture, development tools, user modules and development process, along with ordering information. it also lists the conventions used in this document. this section encompasses the following chapters: pin information on page 23 packaging information on page 27 features powerful harvard architecture processor ?m8c processor speeds to 24 mhz ?low power at high speed ?3.0 to 5.25 v operating voltage ?industrial temperature range: ?40c to +85c advanced peripherals (psoc blocks) ?3 rail-to-rail analog psoc blocks provide: ? ? up to 14-bit adcs ? ? up to 8-bit dacs ? ? programmable gain amplifiers ? ? programmable filters and comparators ?4 digital psoc blocks provide: ? ? 8- to 32-bit timers, counters and pwms ? ? crc and prs modules ? ? full-duplex uart ? ? spi ? masters or slaves ? ? connectable to all gpio pins ?complex peripherals by combining blocks flexible on-chip memory ?2k bytes flash program storage 50,000 erase/write cycles ?256 bytes sram data storage ?in-system serial programming (issp ? ) ?partial flash updates ?flexible protection modes ?eeprom emulation in flash precision, programmable clocking ?internal 2.5% 24/48 mhz oscillator ?high accuracy 24 mhz with optional 32 khz crystal and pll ?optional external oscillator, up to 24 mhz ?internal oscillator for watchdog and sleep programmable pin configurations ?25 ma drive on all gpio ?pull up, pull down, high z, strong, or open drain drive modes on all gpio ?up to 8 analog inputs on gpio ?one 30 ma analog output on gpio ?configurable interrupt on all gpio additional system resources ?i 2 c slave, master, and multi-master to 400 khz ?watchdog and sleep timers ?user-configurable low voltage detection ?integrated supervisory circuit ?on-chip precision voltage reference complete development tools ?free development software (psoc designer) ?full-featured, in-circuit emulator and programmer: full-speed emulation complex breakpoint structure 128k bytes trace memory
section a overview cy8c22xxx preliminary data sheet 14 document no. 38-12009 rev. *d december 22, 2003 getting started the quickest path to understanding the psoc silicon is through the psoc designer software gui. this data sheet is useful for understanding the details of the psoc integrated circuit, but is not a good starting point for a new psoc developer seeking to get a general overview of this new technology. psoc developers are not required to build their own adcs, dacs, and other peripherals. embedded in the psoc designer software are the individual data sheets, performance graphs, and psoc user modules (graphically selected code packets) for the peripherals, such as the incremental adcs, dacs, lcd controllers, op amps, low-pass filters, etc. with simple gui-based selection, placement, and connection, the basic architecture of a design may be developed within psoc designer software without ever writing a single line of code. development kits development kits are available from the following distributors: digi-key, avnet, arrow, and future. the online store at cypress.com ( http://www.onfulfillment.com/cypressstore/ ) contains development kits, c compilers, and all accessories for psoc development. go to the online store web site and click on psoc (programmable system-on-chip) to view a current list of available items. tele-training psoc "tele-training" is available for beginners and is taught by a live marketing or application engineer over the phone. please see http://www.cypress.com/support/training.cfm for more details. five training classes are available to accelerate the learning curve including introduction, designing, debugging, advanced design, advanced analog, as well as application-spe- cific classes covering topics like psoc and the lin bus. consultants certified psoc consultants offer everything from technical assistance to completed psoc designs. to contact or become a psoc consultant go to the following web site, http://www.cypress.com/support/cypros.cfm . technical support psoc application engineers take pride in fast and accurate response. they can be reached with a 4-hour guaranteed response at http://www.cypress.com/support/login.cfm . application notes a long list of application notes will assist you in every aspect of your design effort. go to http://www.cypress.com/design/ results.cfm to locate the psoc application notes.
december 22, 2003 document no. 38-12009 rev. *d 15 cy8c22xxx preliminary data sheet section a overview top-level architecture the figure below illustrates the top-level architecture of the psoc cy8c22xxx. psoc cy8c22xxx top-level block diagram analog input muxing digital system analog system sram port 1 port 0 system bus interrupt controller sleep and watchdog phased locked loop (pll) internal low speed oscillator (ilo) 32 khz crystal oscillator (eco) global digital interconnect global analog interconnect analog drivers 24 mhz internal main oscillator (imo) psoc core cpu core (m8c) supervisory rom (srom) flash nonvolatile memory digital psoc block array analog psoc block array analog column digital row i 2 c internal voltage reference digital clocks por and lvd system resets decimator system resources db db dc dc ct sc sc analog refs
section a overview cy8c22xxx preliminary data sheet 16 document no. 38-12009 rev. *d december 22, 2003 development tools the cypress microsystems psoc designer is a microsoft ? windows-based, integrated development environment for the programmable system-on-chip (psoc) devices. the psoc designer runs on windows 98, windows nt 4.0, win- dows 2000, windows millennium (me), or windows xp. (reference the psoc designer functional flow diagram below.) psoc designer helps the customer to select an operating configuration for the psoc, write application code that uses the psoc, and debug the application. this system provides design database management by project, an integrated debugger with in-circuit emulator, in-system programming support, and the cyasm macro assembler for the cpus. psoc designer also supports a high-level c language com- piler developed specifically for the devices in the family. psoc designer subsystems psoc designer software subsystems device editor psoc designer has several main functions. in the design editor you can easily configure a design and apis are auto- matically generated for the user modules. the device editor subsystem allows the user to select different onboard ana- log and digital components called user modules using the psoc blocks. examples of user modules are adcs, dacs, amplifiers, and filters. the device editor also supports easy development of multi- ple configurations and dynamic reconfiguration. dynamic configuration allows for changing configuration at run time. psoc designer sets up power-on initialization tables for selected psoc block configurations and creates source code for an application framework. the framework contains software to operate the selected components and, if the project uses more than one operating configuration, con- tains routines to switch between different sets of psoc block configurations at runtime. psoc designer can print out a configuration sheet for given project configuration for use during application programming in conjunction with the device data sheet. once the framework is generated, the user can add application-specific code to flesh out the framework. it?s also possible to change the selected compo- nents and regenerate the framework. device database importable design database application database project database user modules database psoc tm emulation pod in-circuit emulator device programmer manufacturing information file psoc configuration sheet graphical designer interface context sensitive help commands results
december 22, 2003 document no. 38-12009 rev. *d 17 cy8c22xxx preliminary data sheet section a overview design browser the design browser allows users to select and import pre- configured designs into the user?s project. user?s can easily browse a catalog of preconfigured designs to facilitate time- to-design. recent examples provided in the tools include a 300-baud modem, lin bus master and slave, fan controller, and magnetic card reader. application editor in the application editor you can edit your c language and assembly language source code. you can also assemble, compile, link, and build. assembler. the macro assembler allows the assembly code to be merged seamlessly with c code. the link librar- ies automatically use absolute addressing or can be com- piled in relative mode, and linked with other software modules to get absolute addressing. c language compiler. an ansi c language compiler sup- ports cypress microsystems? psoc family devices (except for 64-bit doubles). even if you have never worked in the c language before, the product quickly allows you to create complete c programs for the psoc family devices. the embedded, optimizing c compiler provides all the fea- tures of c tailored to the psoc architecture. it comes com- plete with embedded libraries providing port and bus operations, standard keypad and display support, and extended math functionality. debugger the psoc designer debugger subsystem provides hard- ware in-circuit emulation, allowing the designer to test the program in a physical system while providing an internal view of the psoc device. debugger commands allow the designer to read and write program and data memory, read and write io registers, read and write cpu registers, set and clear breakpoints, and provide program run, halt, and step control. the debugger also allows the designer to create a trace buffer of registers and memory locations of interest. online help system the online help system displays online, context-sensitive help for the user. designed for procedural and quick refer- ence, each functional subsystem has its own context-sensi- tive help. this system also provides tutorials and links to faqs and an online support forum to aid the designer in getting started. hardware tools in-circuit emulator a low cost, high functionality ice (in-circuit emulator) is available for development support. this hardware has the capability to program single devices. the emulation consists of a base unit that connects to the pc by way of the parallel port. the base unit is universal and will operate with all psoc devices. emulation pods for each device family are available separately. the emulation pod takes the place of the psoc device in the target board and performs full speed (24 mhz) operation. psoc development tool kit user modules and development process the development process for the psoc is different than a traditional fixed function microcontroller. the flexibility of the psoc architecture comes from configurable analog and dig- ital hardware blocks called psoc blocks. these blocks have the capability to implement a wide variety of user selectable functions. each block has several registers that allow you to select the function. these registers also determine the inter- connections between this block and other blocks, as well as the connection to the i/o pins (reference the figure below). to make the entire development process of your project easier, the psoc designer integrated development envi- ronment (ide) has libraries of open source code software modules, called ?user modules,? that simplify the configura- tion process. these user modules have been created to make selecting and implementing peripheral functions very easy. user modules come in analog, digital, and mixed sig- nal varieties. each user module contains all the register set- tings to implement the selected function and also contains application programmer interface (api) software to make the interface to your source code simple. the development process starts when you open a new project. you than pick a set of user modules, as the basis of the custom configuration for that project. you can view the details of all the available user modules inside the develop- ment software and pick the user modules that are perfect for your application. you then must assign each of these user
section a overview cy8c22xxx preliminary data sheet 18 document no. 38-12009 rev. *d december 22, 2003 modules to hardware resources. you also make the inter- connections between the user modules, and between the user modules and the i/o pins. this process step takes place in the device editor subsystem within psoc designer. there are two views inside this step: one for selecting user modules and one for assigning them to the hardware blocks and interconnecting them. the last action in this step is to ?generate application,? which causes the development soft- ware to automatically generate the required files for the selected configuration. user modules and development process flow chart the next step in the process is to write your main program, and any other sub-routines required by your application. this step takes place in the application editor subsystem. you will have all the subroutines automatically generated for the user modules you have chosen and the source code for these routines can be viewed in this step as well. the differ- ent files created for the project are all contained in a tree structure for easy reference. the development software has a handy ?make? function, which assembles and compiles all source files, and links them into an object file ready for the debugging process. the last step in development takes place in the debugger subsystem. this is where the object code is downloaded into the in-circuit emulator and run. the debugger is both the interface to the ice and also contains an advanced set application editor device editor user module selection view source code editor user module placement view ! browse libraries of user module ! view datasheets for user modules ! select individual user modules to add to configuration ! calculate resource requirements for slected user modules ! assign user modules to hardware psoc blocks ! make interconnections between user modules ! make interconnections to device pins ! edit source code files written in c and assembly language ! assemble/compile ! see breakpoints ! "make" function for generation of enitre project including subfiles debugger interface to in-circuit emulator ! interface to in-circuit emulator for debug ! define complex break events ! enable trace capability ! view contents of program/ register/ram space ! run/stop/step program "generate application" "make" automatic object code generation
december 22, 2003 document no. 38-12009 rev. *d 19 cy8c22xxx preliminary data sheet section a overview of tools for finding and removing bugs from your software. some of the capabilities of the tools are full-speed emula- tion, defining complex breakpoint events, and a large trace memory. ordering information the following table lists the psoc device family?s key features and ordering codes. psoc device family key features package ordering code flash (kbytes) ram (bytes) switch mode pump temperature range digital psoc blocks (rows of 4) analog psoc blocks (columns of 3) digital io pins analog inputs analog outputs xres pin 8 pin (300 mil) dip cy8c22113-24pi 2 256 no -40c to +85c 4 3 6 4 1 no 8 pin (150 mil) soic cy8c22113-24si 2 256 no -40c to +85c 4 3 6 4 1 no 20 pin (300 mil) dip cy8c22213-24pi 2 256 no -40c to +85c 4 3 16 8 1 yes 20 pin (210 mil) ssop cy8c22213-24pvi 2 256 no -40c to +85c 4 3 16 8 1 yes 20 pin (210 mil) ssop (tape and reel) CY8C22213-24PVIT 2 256 no -40c to +85c 4 3 16 8 1 yes 20 pin (300 mil) soic cy8c22213-24si 2 256 no -40c to +85c 4 3 16 8 1 yes 20 pin (300 mil) soic (tape and reel) cy8c22213-24sit 2 256 no -40c to +85c 4 3 16 8 1 yes 32 pin (5x5 mm) mlf cy8c22213-24lfi 2 256 no -40c to +85c 4 3 16 8 1 yes
section a overview cy8c22xxx preliminary data sheet 20 document no. 38-12009 rev. *d december 22, 2003 organization and conventions document organization this document is organized into the following sections: overview architecture registers digital system analog system system resources electrical specifications revision history each section and its associated chapters is organized according to psoc functionality. if applicable, all chapters have a brief introduction, an architectural/application description, register definitions, and timing diagrams. the last section, electrical specifications, has no chapters asso- ciated with it and presents the psoc device?s electrical specifications. the revision history section chronologically lists the document?s history. document conventions register conventions the following table lists the register conventions that are specific to this document. numeric naming hexidecimal numbers are represented with all letters in uppercase with an appended lowercase ?h? (for example, ?14h? or ?3ah?). hexidecimal numbers may also be repre- sented by a ?0x? prefix, the c coding convention. binary numbers have an appended lowercase ?b? (for example, 01010100b? or ?01000011b?). numbers not indicated by an ?h? or ?b? are decimal. units of measure the following table lists the units of measure used in this document. convention example description ?x? in a register name acbxxcr1 multiple instances/address ranges of the same register. rw rw:00 read and write register or bit(s) r r:00 read register or bit(s) w w:00 write register or bit(s) l rl:00 logical register or bit(s) c rc:00 clearable register or bit(s) 00 rw:00 reset value is 0x00 xx rw:xx register is not reset 0, 0,04h register is in bank 0 1, 1, 23h register is in bank 1 x, x,f7h register exists in register bank 0 and reg- ister bank 1 empty, grayed- out table cell reserved bit or group of bits, unless oth- erwise stated. symbol units of measure o c degree celsius ac alternating current db decibels dc direct current ff femto farad hz hertz k kilo, 1000 k 2 10 , 1024 kb 1024 bytes kbit 1024 bits khz kilohertz k ? kilohm mhz megahertz m ? megaohm a microampere s microsecond v microvolts vrms microvolts root-mean-square ma milliampere ms millisecond mv millivolts na nanoamphere ns nanosecond nv nanovolts ? ohm pf pico farad pp peak-to-peak ppm parts per million sps samples per second sigma: one standard deviation v volts
december 22, 2003 document no. 38-12009 rev. *d 21 cy8c22xxx preliminary data sheet section a overview acronyms used the following table lists the acronyms that are used in this document. acronym description ac alternating current ai analog input api application programming interface apor analog power on reset bc broadcast clock cmrr common mode rejection ratio cpu central processing unit crc cyclic redundancy check ct continuous time dac digital-to-analog converter dc direct current dnl differential nonlinearity do digital or data output eco external crystal oscillator eeprom electrically erasable programmable read-only memory fb feedback fsr full scale range gie global interrupt enable gpio general purpose io ice in-circuit emulator ide integrated development environment ilo internal low speed oscillator inl integral nonlinearity io input/output iow io write ipor imprecise power on reset ira interrupt request acknowledge irq interrupt request isr interrupt service routine issp in-circuit system serial programming ivr interrupt vector read lfsr linear feedback shift register lpf low pass filter lsb least-significant bit lut lookup table miso master-in-slave-out mosi master-out-slave-in msb most-significant bit pc program counter pd power down pddsc power system sleep duty cycle pga programmable gain amplifier por power on reset ppor precision power on reset prs pseudo random sequence psoc? programmable system-on-chip psrr power supply rejection ratio pvt process voltage temperature pwm pulse width modulator ram random access memory ras rom access strobe reti return from interrupt ri row input ro row output rom read only memory sar successive approximation register sc switched capacitor snr signal-to-noise ratio soi start of instruction sp stack pointer spd sequential phase detector spi serial peripheral interconnect tc terminal count vco voltage controlled oscillator wdt watchdog timer wdr watchdog reset acronym description
section a overview cy8c22xxx preliminary data sheet 22 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 23 1. pin information this chapter lists, describes, and illustrates the psoc device pins and pinouts. ta b l e 1 - 1 presents a summary of the device pins, and the following tables and illustrations detail a representation of the device?s pinouts. 1.1 pin summary table 1-1. psoc device pin descriptions pin name description input/output vdd supply voltage power vss ground power xres external reset (active high) input p0[0] ? p0[4] port 0[0], 0[1], 0[2], 0[3], 0[4], analog input input/output p0[5] port 0[5], analog input/output input/output p0[6] ? p0[7] port 0[6], 0[7], analog input input/output p1[0] port 1[0], xtalout/sdata / i 2 c sda input/output p1[1] port 1[1], xtalin/sclk / i 2 c scl input/output p1[2] port 1[2] input/output p1[3] port 1[3] input/output p1[4] port 1[4], extclk input/output p1[5] port 1[5], i 2 c sda input/output p1[6] port 1[6] input/output p1[7] port 1[7], i 2 c scl input/output
1. pin information cy8c22xxx preliminary data sheet 24 document no. 38-12009 rev. *d december 22, 2003 1.2 pinouts the psoc devices are available in a variety of packages. refer to the following information for details on individual devices. note that every port pin (labeled with a ?p?), except for vss, vdd, and xres in the following tables and illustrations, is capa ble of digital io. table 1-2. 8-pin part pinout (pdip, soic) pin no. description pin no. description pin no. description 1 p0[5], a in, out 4 vss 7 p0[4], a in 2 p0[3], a in 5 p1[0], xtalout, i 2 c sda 8 vdd 3 p1[1], xtalin, i 2 c scl 6 p0[2], a in legend a: analog, d: digital, io: input or output. table 1-3. 20-pin part pinout (pdip, ssop, soic) pin no. description pin no. description pin no. description 1 p0[7], a in 8p1[3] 15 xres 2 p0[5], a in, out 9 p1[1], xtalin, i 2 c scl 16 p0[0], a in 3 p0[3], a in 10 vss 17 p0[2], a in 4 p0[1], a in 11 p1[0], xtalout, i 2 c sda 18 p0[4], a in 5vss 12 p1[2] 19 p0[6], a in 6 p1[7], i 2 c scl 13 p1[4], extclk 20 vdd 7 p1[5], i 2 c sda 14 p1[6] legend a: analog, d: digital, io: input or output. pdip / soic 1 aio, p0[5] 8 vdd 2 ai, p0[3] 3 i 2 c scl, xtalin, p1[1] 4 vss 7 p0[4], ai 6 p0[2], ai 5 p1[0], xtalout, i 2 c sda pdip / ssop / soic 1 ai, p0[7] 20 vdd 2 aio, p0[5] 3 ai, p0[3] 4 ai, p0[1] 5 vss 6 i 2 c scl, p1[7] 7 i 2 c sda, p1[5] 8 p1[3] 9 i 2 c scl, xtalin, p1[1] 10 vss 19 p0[6], ai 18 p0[4], ai 17 p0[2], ai 16 p0[0], ai 15 xres 14 p1[6] 13 p1[4], extclk 12 p1[2] 11 p1[0], xtalout, i 2 c sda
december 22, 2003 document no. 38-12009 rev. *d 25 cy8c22xxx preliminary data sheet 1. pin information note the mlf package has a center pad that must be connected to the same ground as the vss pin. table 1-4. 32-pin part pinout (mlf) pin no. description pin no. description pin no. description 1 nc 12 vss 23 p0[0], a in 2 nc 13 p1[0], xtalout, i 2 c sda 24 p0[2], a in 3 nc 14 p1[2] 25 nc 4 nc 15 p1[4], extclk 26 p0[4], a in 5vss 16 nc 27 p0[6], a in 6nc 17 p1[6] 28 vdd 7 p1[7], i 2 c scl 18 xres 29 p0[7], a in 8 p1[5], i 2 c sda 19 nc 30 p0[5], a in, out 9nc 20 nc 31 p0[3], a in 10 p1[3] 21 nc 32 p0[1], a in 11 p1[1], xtalin, i 2 c scl 22 nc legend a: analog, d: digital, io: input or output, nc: no connection. mlf (top view) 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 24 23 22 21 20 19 18 17 32 31 30 29 28 27 26 25 p0[1] ai p0[3] ai p0[5] aio p0[7] ai vdd p0[6] ai p0[4] ai nc nc nc nc nc vss nc i 2 c scl p1[7] i 2 c sda p1[5] p0[2] ai p0[0] ai nc nc nc nc xres p1[6] nc p1[3] xtalin, i 2 c scl p1[1] vss xtalout, i 2 c sda p1[0] p1[2] extclk p1[4] nc
1. pin information cy8c22xxx preliminary data sheet 26 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 27 2. packaging information this chapter presents and illustrates the packaging specifications for the psoc device, along with the thermal impedances for each package. 2.1 packaging dimensions figure 2-1. 8-lead (300-mil) pdip 51-85075 *a
2. packaging information cy8c22xxx preliminary data sheet 28 document no. 38-12009 rev. *d december 22, 2003 figure 2-2. 8-lead (150-mil) soic figure 2-3. 20-lead (300-mil) molded dip 51-85066 *b 51-85011-a
december 22, 2003 document no. 38-12009 rev. *d 29 cy8c22xxx preliminary data sheet 2. packaging information figure 2-4. 20-lead (210-mil) ssop figure 2-5. 20-lead (300-mil) molded soic 51-85077 *c 51-85024 *b
2. packaging information cy8c22xxx preliminary data sheet 30 document no. 38-12009 rev. *d december 22, 2003 figure 2-6. 32-lead (5x5 mm) mlf 2.2 thermal impedances table 2-1. thermal impedances per package package typical ja 8 pdip 123 o c/w 8 soic 185 o c/w 20 pdip 109 o c/w 20 ssop 117 o c/w 20 soic 81 o c/w 32 mlf 22 o c/w 51-85188 ** 32 x = 138 mil y = 138 mil
december 22, 2003 document no. 38-12009 rev. *d 31 section b core architecture the architecture section discusses the core components of the psoc device and the registers associated with those compo- nents. this section encompasses the following chapters: cpu core (m8c) on page 35 supervisory rom (srom) on page 45 interrupt controller on page 51 general purpose io (gpio) on page 55 analog output drivers on page 61 internal main oscillator (imo) on page 63 internal low speed oscillator (ilo) on page 65 32 khz crystal oscillator (eco) on page 67 phase locked loop (pll) on page 71 sleep and watchdog on page 73 top-level core architecture the figure below displays the top-level architecture of the psoc?s core. each component of the figure is discussed at length in this section. psoc core block diagram sram system bus interrupt controller sleep and watchdog cpu core (m8c) supervisory rom (srom) flash nonvolatile memory port 1 port 0 analog drivers phased locked loop (pll) internal low speed oscillator (ilo) 32 khz crystal oscillator (eco) 24 mhz internal main oscillator (imo)
section b core architecture cy8c22xxx preliminary data sheet 32 document no. 38-12009 rev. *d december 22, 2003 core register summary the table below lists all the psoc registers that the core of the device uses. summary table of the core registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access m8c registers m8c register x,f7h cpu_f xoi carry zero gie rl : 00 related registers 1,e0h osc_cr0 32k select pll mode no buzz sleep[1:0] cpu speed[2:0] rw : 00 x,ffh cpu_scr0 gies wdrs pors sleep stop rw : 17 supervisory rom (srom) register x,feh cpu_scr1 iramdis rw : 00 interrupt controller registers 0,dah int_clr0 vc3 sleep gpio analog 1 v monitor rw : 00 0,dbh int_clr1 dcb03 dcb02 dbb01 dbb00 rw : 00 0,ddh int_clr3 i2c rw : 00 0,deh int_msk3 enswint i2c rw : 00 0,e0h int_msk0 vc3 sleep gpio analog 1 v monitor rw : 00 0,e1h int_msk1 dcb03 dcb02 dbb01 dbb00 rw : 00 0,e2h int_vc pending interrupt[7:0] rc : 00 x,f7h cpu_f xoi carry zero gie rl : 00 general purpose io (gpio) registers 0,00h prt0dr data input[7:0] rw : 00 0,01h prt0ie interrupt enables[7:0] rw : 00 0,02h prt0gs global select[7:0] rw : 00 0,03h prt0dm2 drive mode 2[7:0] rw : ff 1,00h prt0dm0 drive mode 0[7:0] rw : 00 1,01h prt0dm1 drive mode 1[7:0] rw : ff 1,02h prt0ic0 interrupt control 0[7:0] rw : 00 1,03h prt0ic1 interrupt control 1[7:0] rw : 00 0,04h prt1dr data input[7:0] rw : 00 0,05h prt1ie interrupt enables[7:0] rw : 00 0,06h prt1gs global select[7:0] rw : 00 0,07h prt1dm2 drive mode 2[7:0] rw : ff 1,04h prt1dm0 drive mode 0[7:0] rw : 00 1,05h prt1dm1 drive mode 1[7:0] rw : ff 1,06h prt1ic0 interrupt control 0[7:0] rw : 00 1,07h prt1ic1 interrupt control 1[7:0] rw : 00 analog output driver register 1,62h abf_cr0 acol1mux abuf1en0 bypass pwr rw : 00 internal main oscillator (imo) register 1,e8h imo_tr trim[7:0] w : 00 internal low speed oscillator (ilo) register 1,e9h ilo_tr bias trim[1:0] freq trim[3:0] w : 00 32 khz crystal oscillator (eco) register 1,e0h osc_cr0 32k select pll mode no buzz sleep[1:0] cpu speed[2:0] rw : 00 1,ebh eco_tr pssdc[1:0] w : 00 x,feh cpu_scr1 iramdis rw : 00 phase locked loop (pll) registers 1,e0h osc_cr0 32k select pll mode no buzz sleep[1:0] cpu speed[2:0] rw : 00 1,e2h osc_cr2 pllgain extclken imodis sysclkx2 dis rw : 00
december 22, 2003 document no. 38-12009 rev. *d 33 cy8c22xxx preliminary data sheet section b core architecture sleep and watchdog registers 0,e0h int_msk0 vc3 sleep gpio analog 1 v monitor rw : 00 0,e3h res_wdt wdsl_clear w : 00 x,feh cpu_scr1 eco exw eco ex iramdis rw : 00 1,e0h osc_cr0 32k select pll mode no buzz sleep[1:0] cpu speed[2:0] rw : 00 1,e9h ilo_tr bias trim[1:0] freq trim[3:0] w : 00 1,ebh eco_tr pssdc[1:0] w : 00 x,ffh cpu_scr0 gies wdrs pors sleep stop w : xx legend l: the and, or, and xor flag instructions can be used to modify this register. #: access is bit specific. refer to register detail for additional information. x: the value for power on reset is unknown. x: an ?x? before the comma in the address field indicates that this register can be accessed or written to no matter what bank is used. summary table of the core registers (continued) address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access
section b core architecture cy8c22xxx preliminary data sheet 34 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 35 3. cpu core (m8c) this chapter explains the cpu core, called m8c, and its associated registers. it covers the internal m8c registers, address spaces, instruction formats, and addressing modes. for additional information concerning the m8c instruction set, reference the assembly language user guide available at the cypress.com web site. the m8c is a four mips 8-bit harvard architecture micropro- cessor. code selectable processor clock speeds from 93.7 khz to 24 mhz allow the m8c to be tuned to a particular application?s performance and power requirements. the m8c supports a rich instruction set which allows for efficient low-level language support. 3.1 internal registers the m8c has five internal registers that are used in program execution. the following is a list of these registers. accumulator ( a ) index ( x ) program counter ( pc ) ? internal use only stack pointer ( sp ) flags ( f ) all of the internal m8c registers are eight bits in width except for the pc which is 16 bits wide. upon reset, a , x , pc , and sp are reset to 00h. the flag register ( f ) is reset to 02h , indicating that the z flag is set. with each stack operation, the sp is automatically incre- mented or decremented so that it always points to the next stack byte in ram. if the last byte in the stack is at address ffh the stack pointer will wrap to ram address 00h . it is the firmware developer?s responsibility to ensure that the stack does not overlap with user-defined variables in ram. with the exception of the f register, the m8c internal regis- ters are not accessible via an explicit register address. the internal m8c registers are accessed using instructions such as: mov a, expr mov x, expr swap a, sp or f, expr jmp label the f register may be read by using address f7h in either register bank. 3.2 address spaces the m8c has three address spaces: rom, ram, and regis- ters. the rom address space includes the supervisory rom (srom) and the flash. the rom address space is accessed via its own address and data bus. figure 3-1 illus- trates the arrangement of the psoc microcontroller address spaces. the rom address space is composed of the supervisory rom and the on-chip flash program store. flash is orga- nized into 64-byte blocks. the user need not be concerned with program store page boundaries, as the m8c automati- cally increments the 16-bit pc on every instruction making the block boundaries invisible to user code. instructions occurring on a 256-byte flash page boundary (with the table 3-1. m8c registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access m8c register x,f7h cpu_f xoi carry zero gie rl : 00 related registers 1,e0h osc_cr0 32k select pll mode no buzz sleep[1:0] cpu speed[2:0] rw : 00 x,ff cpu_scr0 gies wdrs pors sleep stop rw : 17 legend l: the and, or, and xor flag instructions can be used to modify this register. x: an ?x? before the comma in the address field indicates that this register can be accessed or written to no matter what bank is used.
3. cpu core (m8c) cy8c22xxx preliminary data sheet 36 document no. 38-12009 rev. *d december 22, 2003 exception of jmp instructions) incur an extra m8c clock cycle as the upper byte of the pc is incremented. the register address space is used to configure the psoc microcontroller?s programmable blocks. it consists of two banks of 256 bytes each. to switch between banks, the xio bit in the flag register is set or cleared (set for bank1, cleared for bank0). the common convention is to leave the bank set to bank0 ( xio cleared), switch to bank1 as needed (set xio ), then switch back to bank0. figure 3-1. m8c microcontroller address spaces registers ram rom bank 0 256 bytes bank 1 256 bytes page 0 256 bytes srom flash m x 64 byte blocks legend m: total number of flash blocks in device xio: register bank selection ior: register read iow: register write mr: memory read mw: memory write mw mr iow ior xio db[7:0] da[7:0] id[7:0] pc[15:0] m8c a f sp pc x
december 22, 2003 document no. 38-12009 rev. *d 37 cy8c22xxx preliminary data sheet 3. cpu core (m8c) 3.3 instruction set summary the instruction set is summarized below in table 3-2 . it is described in detail in the psoc designer assembly language user guide (reference the cypress.com web site). table 3-2. instruction set summary opcode hex cycles bytes instruction format flags opcode hex cycles bytes instruction format flags opcode hex cycles bytes instruction format flags 00 15 1 ssc 2d 8 2 or [x+expr], a z 5a 5 2 mov [expr], x 01 4 2 add a, expr c, z 2e 9 3 or [expr], expr z 5b 4 1 mov a, x z 02 6 2 add a, [expr] c, z 2f 10 3 or [x+expr], expr z 5c 4 1 mov x, a 03 7 2 add a, [x+expr] c, z 30 9 1 halt 5d 6 2 mov a, reg[expr] z 04 7 2 add [expr], a c, z 31 4 2 xor a, expr z 5e 7 2 mov a, reg[x+expr] z 05 8 2 add [x+expr], a c, z 32 6 2 xor a, [expr] z 5f 10 3 mov [expr], [expr] 06 9 3 add [expr], expr c, z 33 7 2 xor a, [x+expr] z 60 5 2 mov reg[expr], a 07 10 3 add [x+expr], expr c, z 34 7 2 xor [expr], a z 61 6 2 mov reg[x+expr], a 08 4 1 push a 35 8 2 xor [x+expr], a z 62 8 3 mov reg[expr], expr 09 4 2 adc a, expr c, z 36 9 3 xor [expr], expr z 63 9 3 mov reg[x+expr], expr 0a 6 2 adc a, [expr] c, z 37 10 3 xor [x+expr], expr z 64 4 1 asl a c, z 0b 7 2 adc a, [x+expr] c, z 38 5 2 add sp, expr 65 7 2 asl [expr] c, z 0c 7 2 adc [expr], a c, z 39 5 2 cmp a, expr if (a=b) z=1 if (a 3. cpu core (m8c) cy8c22xxx preliminary data sheet 38 document no. 38-12009 rev. *d december 22, 2003 3.4 instruction format the m8c has a total of seven instruction formats which use instruction lengths of one, two, and three bytes. all instruc- tion bytes are fetched from the program memory (flash) using an address and data bus that are independent from the address and data buses used for register and ram access. while examples of instructions will be given in this section, refer to the psoc designer assembly language user guide for detailed information on individual instructions. 3.4.1 one-byte instructions many instructions, such as some of the mov instructions, have single-byte forms because they do not use an address or data as an operand. as shown in ta b l e 3 - 3 , one-byte instructions use an 8-bit opcode. the set of one-byte instructions can be divided into four categories according to where their results are stored. the first category of one-byte instructions are those that do not update any registers or ram. only the one-byte nop and ssc instructions fit this category. while the program counter is incremented as these instructions execute they do not cause any other internal m8c registers to be updated nor do these instructions directly affect the register space or the ram address space. the ssc instruction will cause srom code to run which will modify ram and m8c internal registers. the second category has only the two push instructions in it. the push instructions are unique because they are the only one-byte instructions that cause a ram address to be modified. these instructions automatically increment the sp . the third category has only the halt instruction in it. the halt instruction is unique because it is the only single-byte instruction that causes a user register to be modified. the halt instruction modifies user register space address ffh ( cpu_scr ). the final category for single-byte instructions are those that cause internal m8c registers to be updated. this category holds the largest number of instructions: asl , asr , cpl , dec , inc , mov , pop , ret , reti , rlc , romx , rrc , swap . these instructions can cause the a , x , and sp regis- ters or sram to be updated. 3.4.2 two-byte instructions the majority of m8c instructions are two bytes in length. while these instructions can be divided into categories iden- tical to the one-byte instructions this would not provide a useful distinction between the three two-byte instruction for- mats that the m8c uses. the first two-byte instruction format shown in ta b l e 3 - 4 is used by short jumps and calls: call , jmp , jacc , index , jc , jnc , jnz , jz . this instruction format uses only 4-bits for the instruction opcode leaving 12-bits to store the relative destination address in a two?s-complement form.these instructions can change program execution to an address relative to the current address by -2048 or +2047. the second two-byte instruction format ( ta b l e 3 - 4 ) is used by instructions that employ the source immediate address- ing mode ( ?source immediate? on page 39 ). the destination for these instructions is an internal m8c register while the source is a constant value. an example of this type of instruction would be add a, 7 . the third two-byte instruction format is used by a wide range of instructions and addressing modes. the following is a list of the addressing modes that use this third two-byte instruc- tion format: source direct ( add a, [7] ) source indexed ( add a, [x+7] ) destination direct ( add [7], a ) destination indexed ( add [x+7], a ) source indirect post increment ( mvi a, [7] ) destination indirect post increment ( mvi [7], a ) for more information on addressing modes see ?addressing modes? on page 39 . table 3-3. one-byte instruction format byte 0 8-bit opcode table 3-4. two-byte instruction formats byte 0 byte 1 4-bit opcode 12-bit relative address 8-bit opcode 8-bit data 8-bit opcode 8-bit address
december 22, 2003 document no. 38-12009 rev. *d 39 cy8c22xxx preliminary data sheet 3. cpu core (m8c) 3.4.3 three-byte instructions the three-byte instruction formats are the second most prevalent instruction formats. these instructions need three bytes because they either move data between two addresses in the user-accessible address space (registers and ram) or they hold 16-bit absolute addresses as the destination of a long jump or long call. the first instruction format shown in table 3-5 is used by the ljmp and lcall instructions. these instructions change program execution unconditionally to an absolute address. the instructions use an 8-bit opcode leaving room for a 16- bit destination address. the second three-byte instruction format shown in table 3-5 is used by the following two addressing modes: destination direct source immediate ( add [7], 5 ) . destination indexed source immediate ( add [x+7], 5 ). the third three-byte instruction format is for the destination direct source direct addressing mode which is used by only one instruction. this instruction format uses an 8-bit opcode followed by two 8-bit addresses. the first address is the destination address in ram while the second address is source address in ram. the following is an example of this instruction: mov [7], [5] . 3.5 addressing modes the m8c has ten addressing modes: source immediate source direct source indexed destination direct destination indexed destination direct source immediate destination indexed source immediate destination direct source direct source indirect post increment destination indirect post increment 3.5.1 source immediate for these instructions the source value is stored in operand 1 of the instruction. the result of these instructions is placed in either the m8c a , f , or x register as indicated by the instruction?s opcode. all instructions using the source imme- diate addressing mode are two bytes in length. source immediate examples: table 3-5. three-byte instruction formats byte 0 byte 1 byte 2 8-bit opcode 16-bit address (msb, lsb) 8-bit opcode 8-bit address 8-bit data 8-bit opcode 8-bit address 8-bit address table 3-6. source immediate opcode operand 1 instruction immediate value source code machine code comments add a, 7 01 07 the immediate value 7 is added to the accumulator. the result is placed in the accumulator. mov x, 8 57 08 the immediate value 8 is moved into the x register. and f, 9 70 09 the immediate value of 9 is logically and?ed with the f register and the result is placed in the f register.
3. cpu core (m8c) cy8c22xxx preliminary data sheet 40 document no. 38-12009 rev. *d december 22, 2003 3.5.2 source direct for these instructions the source address is stored in oper- and 1 of the instruction. during instruction execution the address will be used to retrieve the source value from ram or register address space. the result of these instructions is placed in either the m8c a or x register as indicated by the instruction?s opcode. all instructions using the source direct addressing mode are two bytes in length. source direct examples: 3.5.3 source indexed for these instructions the source offset from the x register is stored in operand 1 of the instruction. during instruction execution the current x register value is added to the signed offset to determine the address of the source value in ram or register address space. the result of these instructions is placed in either the m8c a or x register as indicated by the instruction?s opcode. all instructions using the source indexed addressing mode are two bytes in length. source indexed examples: 3.5.4 destination direct for these instructions the destination address is stored in the machine code of the instruction. the source for the oper- ation is either the m8c a or x register as indicated by the instruction?s opcode. all instructions using the destination direct addressing mode are two bytes in length. destination direct examples: table 3-7. source direct opcode operand 1 instruction source address source code machine code comments add a, [7] 02 07 the value in memory at address 7 is added to the accumulator and the result is placed into the accumulator. mov a, reg[8] 5d 08 the value in the register space at address 8 is moved into the accu- mulator. table 3-8. source indexed opcode operand 1 instruction source index source code machine code comments add a, [x+7] 03 07 the value in memory at address x+7 is added to the accumulator. the result is placed in the accumulator. mov x, [x+8] 59 08 the value in ram at address x+8 is moved into the x register. table 3-9. destination direct opcode operand 1 instruction destination address source code machine code comments add [7], a 04 07 the value in the accumulator is added to memory, at address 7. the result is placed in memory at address 7. the accumulator is unchanged. mov reg[8], a 60 08 the accumulator value is moved to register space at address 8. the accumulator is unchanged.
december 22, 2003 document no. 38-12009 rev. *d 41 cy8c22xxx preliminary data sheet 3. cpu core (m8c) 3.5.5 destination indexed for these instructions the destination offset from the x regis- ter is stored in the machine code for the instruction. the source for the operation is either the m8c a register or an immediate value as indicated by the instruction?s opcode. all instructions using the destination indexed addressing mode are two bytes in length. destination indexed example: 3.5.6 destination direct source immediate for these instructions the destination address is stored in operand 1 of the instruction. the source value is stored in operand 2 of the instruction. all instructions using the desti- nation direct source immediate addressing mode are three bytes in length. destination direct source immediate examples: 3.5.7 destination indexed source immediate for these instructions the destination offset from the x regis- ter is stored in operand 1 of the instruction. the source value is stored in operand 2 of the instruction. all instruc- tions using the destination indexed source immediate addressing mode are three bytes in length. destination indexed source immediate examples: table 3-10. destination indexed opcode operand 1 instruction destination index source code machine code comments add [x+7], a 05 07 the value in memory at address x+7 is added to the accumulator. the result is placed in memory at address x+7. the accumulator is unchanged. table 3-11. destination direct source immediate opcode operand 1 operand 2 instruction destination address immediate value source code machine code comments add [7], 5 06 07 05 the value in memory at address 7 is added to the immediate value 5. the result is placed in memory at address 7. mov reg[8], 6 62 08 06 the immediate value 6 is moved into register space at address 8. table 3-12. destination indexed source immediate opcode operand 1 operand 2 instruction destination index immediate value source code machine code comments add [x+7], 5 07 07 05 the value in memory at address x+7 is added to the immediate value 5. the result is placed in memory at address x+7. mov reg[x+8], 6 63 08 06 the immediate value 6 is moved into the register space at address x+8.
3. cpu core (m8c) cy8c22xxx preliminary data sheet 42 document no. 38-12009 rev. *d december 22, 2003 3.5.8 destination direct source direct only one instruction uses this addressing mode. the desti- nation address is stored in operand 1 of the instruction. the source address is stored in operand 2 of the instruction. all instructions using the destination direct source direct addressing mode are three bytes in length. destination direct source direct example: 3.5.9 source indirect post increment only one instruction uses this addressing mode. the source address stored in operand 1 is actually the address of a pointer. during instruction execution the pointer?s current value is read to determine the address in ram where the source value will be found. the pointer?s value is incre- mented after the source value is read. for psoc microcon- trollers with more than 256 bytes of ram, the data page read ( dpr_dr ) register is used to determine which ram page to use with the source address. therefore, values from pages other than the current page may be retrieved without changing the current page pointer ( cpp_dr ). the pointer is always read from the current ram page. for information on the dpr_dr and cpp_dr registers, see the device data sheet. source indirect post increment example: 3.5.10 destination indirect post increment only one instruction uses this addressing mode. the desti- nation address stored in operand 1 is actually the address of a pointer. during instruction execution the pointer?s current value is read to determine the destination address in ram where the accumulator?s value will be stored. the pointer?s value is incremented after the value is written to the destina- tion address. for psoc microcontrollers with more than 256 bytes of ram, the data page write ( dpw_dr ) register is used to determine which ram page to use with the destina- tion address. therefore, values may be stored in pages other than the current page without changing the current page pointer ( cpp_dr ). the pointer is always read from the current ram page. for information on the dpr_dr and cpp_dr registers, see the device data sheet. table 3-13. destination direct source direct opcode operand 1 operand 2 instruction destination address source address source code machine code comments mov [7], [8] 5f 07 08 the value in memory at address 8 is moved to memory at address 7. table 3-14. source indirect post increment opcode operand 1 instruction source address pointer source code machine code comments mvi a, [8] 3e 08 the value in memory at address 8 (the indirect address) points to a memory location in ram. the value at the memory location pointed to by the indirect address is moved into the accumulator. the indirect address, at address 8 in memory, is then incremented. table 3-15. destination indirect post increment opcode operand 1 instruction destination address pointer
december 22, 2003 document no. 38-12009 rev. *d 43 cy8c22xxx preliminary data sheet 3. cpu core (m8c) destination indirect post increment example: 3.6 register definitions 3.6.1 cpu_f (flag) register the flag register has four chip dependent bits (fl[7:4]) and four dedicated bits (fl[3:0]), as shown in ta b l e 3 - 1 . 3.6.1.1 chip-dependent flag bits the chip-dependent flag bits have no effect internally on the m8c. these bits are manipulated by the user with the flag-logic opcodes (for example, xor f, 80h). bit defini- tions for the psoc mixed signal array family are as follows. bits 7, 6, and 5: reserved. bit 4: xoi. io bank select. this bit is used to select between register banks, in order to support more than 256 registers. 3.6.1.2 dedicated flag bits the dedicated flag bits are described as follows. bit 3: reserved. bit 2: carry. carry flag. this bit is set or cleared in response to the result of several instructions. it may also be manipulated by the flag-logic opcodes (for example, or f, 4). see the psoc designer assembly guide user manual for more details. bit 1: zero. zero flag. this bit is set or cleared in response to the result of several instructions. it may also be manipu- lated by the flag-logic opcodes (for example, or f, 2). see the psoc designer assembly guide user manual for more details. bit 0: gie. global interrupt enable. the state of this bit determines whether interrupts (by way of the irq) will be recognized by the m8c. this bit is set or cleared by the user, using the flag-logic opcodes (e.g., or f, 1). gie is also cleared automatically by the interrupt routine, after the flag byte has been stored on the stack. for gie=1, the m8c samples the irq input for each instruc- tion. for gie=0, the m8c ignores the irq. for additional information, reference the cpu_f register on page 142 . source code machine code comments mvi [8], a 3f 08 the value in memory at address 8 (the indirect address) points to a memory location in ram. the accumulator value is moved into the memory location pointed to by the indirect address. the indirect address in memory, at address 8, is then incremented.
3. cpu core (m8c) cy8c22xxx preliminary data sheet 44 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 45 4. supervisory rom ( srom ) this chapter discusses the supervisory rom (srom) and its associated register. it covers both the physical srom block and the code stored in the srom for the psoc devices. the srom holds code that is used to boot the part, calibrate circuitry, and perform flash operations. the functions of the srom may be accessed in normal user code, operating from flash. 4.1 architectural description the srom is used to boot the part and provide interface functions to the flash macros. ( ta b l e 4 - 2 lists the srom functions.) the srom functions are accessed by executing the supervisory system call instruction (ssc) which has an opcode of 00h. prior to executing the ssc the m8c?s accu- mulator needs to be loaded with the desired srom function code from ta bl e 4 - 2 . undefined functions will cause a halt if called from user code. the srom functions are executing code with calls; therefore, the functions require stack space. with the exception of reset, all of the srom functions have a parameter block in sram that must be configured before executing the ssc. ta b l e 4 - 3 lists all possible parameter block variables. the meaning of each parameter, with regards to a specific srom function, is described later in this chapter. two important variables that are used for all functions are key1 and key2. these variables are used to help discrimi- nate between valid sscs and inadvertent sscs. key1 must always have a value of 3ah, while key2 must have the same value as the stack pointer when the srom function begins execution. this would be the sp value when the ssc opcode is executed, plus three. if either of the keys do not match the expected values, the m8c will halt (with the exception of the swbootreset function). the following code puts the correct value in key1 and key2. the code starts with a halt, to force the program to jump directly into the setup code and not run into it. halt sscop: mov [key1], 3ah mov x, sp mov a, x add a, 3 mov [key2], a table 4-1. srom register address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access x,feh cpu_scr1 iramdis rw:00 legend x: an ?x? before the comma in the address field indicates that this register can be accessed or written to no matter what bank is used. table 4-2. list of srom functions function code function name stack space needed 00h swbootreset 0 01h readblock 7 02h writeblock 10 03h eraseblock 9 06h tableread 3 07h checksum 3 08h calibrate0 4 09h calibrate1 3 table 4-3. srom function variables variable name sram address key1 / counter / return code 0,f8h key2 / tmp 0,f9h blockid 0,fah pointer 0,fbh clock 0,fch reserved 0,fdh delay 0,feh reserved 0,ffh
4. supervisory rom (srom) cy8c22xxx preliminary data sheet 46 document no. 38-12009 rev. *d december 22, 2003 4.1.1 additional srom feature the srom has the following additional srom feature. return codes: these aid in the determination of success or failure of a particular function. the return code is stored in key1?s position in the parameter block. the checksum and tableread functions do not have return codes because key1?s position in the parameter block is used to return other data. note read, write, and erase operations may fail if the target block is read or write protected. block protection levels are set during device programming. 4.1.2 srom function descriptions 4.1.2.1 swbootreset function the srom function swbootreset is the function that is responsible for transitioning the device from a reset state to running user code. see the types of resets chapter for more information on what events will cause the swbootre- set function to execute. the swbootreset function is executed whenever the srom is entered with an m8c accumulator value of 00h: the sram parameter block is not used as an input to the function. this will happen, by design, after a hardware reset, because the m8c's accumulator is reset to 00h or when user code executes the ssc instruction with an accumulator value of 00h. the swbootreset's calibration function, calibrate1, trans- fers the calibration data one byte at a time from flash to sram. as the bytes are transferred, the sum of the bytes, plus a hard coded offset value of ebh, is calculated in a 2- byte sram variable (checksum). if at the end of the transfer the value of checksum (plus the offset value of ebh) is zero, the swbootreset function uses the values stored in sram to calibrate the registers in the psoc device. if checksum has a non-zero value, the ires bit in cpu_scr1 is set, which causes a hardware reset similar to a por event. for more information on this condition, see ?system resets? on page 281 . if the checksum of the calibration data is zero, the swbootreset function ends by setting the m8c registers (cpu_sp, cpu_pc, cpu_x, cpu_f, cpu_a) to 00h, after writing 00h to most sram addresses, and then begins to execute user code at address 0000h. tab l e 4 - 5 documents the value of all the sram addresses in page zero, after a successful swbootreset. a cell in the table with ?xx? in it, indicates that the sram address is not modified by the swbootreset function. a hex value in a cell indicates that the address should always have the indicated value after a successful swbootreset. a cell with a ???? in it indicates that the value, after a swbootreset, is determined by the value of iramdis in cpu_scr1. if iramdis is not set, these addresses will be initialized to 00h. if iramdis is set, these addresses will not be modified by a swbootreset. the iramdis bit allows variables to be preserved even if a watchdog reset occurs. the iramdis bit is reset by all system resets except watch- dog reset. therefore, this bit is only useful for watchdog resets and not general resets. address f8h is the return code byte for all srom functions, for this function, the only acceptable values are 00h and 02h. address fch is the fail count variable. after por, wdr, or xres, the variable is initialized to 00h by the srom. each time the checksum fails, the fail count is incre- mented. therefore, if it takes two passes through table 4-4. srom return code meanings return code value description 00h success 01h function not allowed due to level of protection on block 02h software reset without hardware reset 03h fatal error, srom halted table 4-5. sram map post swbootreset address 0 1 2 3 4 5 6 7 8 9 a b c d e f 0x0_ 0x00 0x00 0x00 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 0x1_ ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 0x2_ ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 0x3_ ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 0x4_ ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 0x5_ ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 0x6_ ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 0x7_ ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 0x8_ ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 0x9_ ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 0xa_ ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 0xb_ ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 0xc_ ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 0xd_ ?? ?? ?? ?? ?? ?? ?? ?? 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xe_ 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xf_ 0x00 0x00 0x00 0x00 0x00 0x00 ?? ?? 0x00 0x02 xx 0x00 0x00 0xn xx 0x00 0x00
december 22, 2003 document no. 38-12009 rev. *d 47 cy8c22xxx preliminary data sheet 4. supervisory rom (srom) swbootreset to get a good checksum, the fail count would be 01h. 4.1.2.2 read block function the readblock function is used to read 64 contiguous bytes from flash: a block. the number of blocks in a device is sim- ply the total number of bytes divided by 64. for the cy8c22xxx, the flash contains 32 blocks of 64 bytes. the first thing this function does is check the protection bits and determine if the desired blockid is readable. if read protection is turned on, the readblock function will exit set- ting the accumulator and key2 back to 00h. key1 will have a value of 01h, indicating a read failure. if read protection is not enabled, the function will read 64 bytes from the flash using a romx instruction and store the results in sram using an mvi instruction. the first of the 64 bytes will be stored in sram at the address indicated by the value of the pointer parameter. when the readblock completes successfully the accumulator, key1 and key2 will all have a value of 00h. 4.1.2.3 writeblock function the writeblock function is used to store data in the flash. data is moved 64 bytes at a time from sram to flash using this function. the first thing the writeblock function does is check the pro- tection bits and determine if the desired blockid is write- able. if write protection is turned on, the writeblock function will exit setting the accumulator and key2 back to 00h. key1 will have a value of 01h, indicating a write failure. the configuration of the writeblock function is straight for- ward. the blockid of the flash block, where the data is stored, must be determined and stored at sram address fah. valid blockid values are between 00h and. the sram address of the first of the 64 bytes to be stored in flash must be indicated using the pointer variable in the parameter block (sram address fbh). finally, the clock and delay value must be set correctly. the clock value determines the length of the write pulse that will be used to store the data in the flash. the clock and delay values are dependent on the cpu speed and must be set correctly. refer to ?clocking? on page 49 for additional information. 4.1.2.4 eraseblock function the eraseblock function is used to erase a block of 64 con- tiguous bytes in flash. the first thing the eraseblock function does is check the protection bits and determine if the desired blockid is writeable. if write protection is turned on, the eraseblock function will exit setting the accumulator and key2 back to 00h. key1 will have a value of 01h, indicating a write failure. to set up the parameter block for the eraseblock function, correct key values must be stored in key1 and key2. the block number to be erased must be stored in the blockid variable and the clock and delay values must be set based on the current cpu speed. for more information on setting the clock and delay values, see ?clocking? on page 49 . table 4-6. readblock parameters (01h) name address description key1 0,f8h 3ah key2 0,f9h stack pointer value, when ssc is exe- cuted. blockid 0,fah flash block number pointer 0,fbh first of 64 addresses in sram where returned data should be stored. table 4-7. writeblock parameters (02h) name address description key1 0,f8h 3ah key2 0,f9h stack pointer value, when ssc is exe- cuted. blockid 0,fah flash block number (00h ? 3fh). pointer 0,fbh first of 64 addresses in sram, where the data to be stored in flash is located prior to calling writeblock. clock 0,fch clock divider used to set the write pulse width. delay 0,feh for a cpu speed of 12 mhz set to 56h. table 4-8. eraseblock parameters (03h) name address description key1 0,f8h 3ah key2 0,f9h stack pointer value, when ssc is exe- cuted. blockid 0,fah flash block number (00h ? 3fh). clock 0,fch clock divider used to set the erase pulse width. delay 0,feh for a cpu speed of 12 mhz set to 56h.
4. supervisory rom (srom) cy8c22xxx preliminary data sheet 48 document no. 38-12009 rev. *d december 22, 2003 4.1.2.5 tableread function the tableread function gives the user access to part-spe- cific data stored in the flash during manufacturing. it also returns a revision id for the die (not to be confused with the silicon id stored in table 0). 4.1.2.6 checksum function the checksum function calculates a 16-bit checksum over a user specifiable number of blocks, within a single flash macro (bank) starting from block zero. the blockid parameter is used to pass in the number of blocks to calcu- late the checksum over. a blockid value of 1 will calculate the checksum of only block 0, while a blockid value of 0 will calculate the checksum of all 256 user blocks. the 16-bit checksum is returned in key1 and key2. the parameter key1 holds the lower 8 bits of the checksum and the parameter key2 holds the upper 8 bits of the checksum. the checksum algorithm executes the following sequence of three instructions over the number of blocks times 64 to be checksumed. romx add [key1], a adc [key2], 0 4.1.2.7 calibrate0 function the calibrate0 function transfers the calibration values stored in a special area of the flash to their appropriate reg- isters. 4.1.2.8 calibrate1 function while calibrate1 is a completely separate function from calibrate0, they perform the same function, which is to transfer the calibration values stored in a special area of the flash to their appropriate registers. what is unique about calibrate1 is that it calculates a checksum of the calibration data and, if that checksum is determined to be invalid, calibrate1 will cause a hardware reset by setting the ires bit of cpu_scr1. the calibrate1 function uses sram to calculate a check- sum of the calibration data. the pointer value is used to indicate the address of a 30 byte buffer used by this func- tion. when the function completes, the 30 bytes will be set to 00h. calibrate1 was created as a sub function of swbootreset. however, the calibrate1 function code was added to provide direct access. for more information on how calibrate1 works, see the swbootreset section. table 4-9. tableread parameters (06h) name address description key1 0,f8h 3ah key2 0,f9h stack pointer value, when ssc is exe- cuted. blockid 0,fah table number to read. table 4-10. table with assigned values in flash macro 0 f8h f9h fah fbh fch fdh feh ffh table 0 silicon id (may be used for serialization in the future.) table 1 voltage reference trim for 3.3 v reg[1,ea] main oscillator trim for 3.3 v reg[1,e8] room temperature calibration for 3.3v hot temperature calibration for 3.3v voltage reference trim for 5 v reg[1,ea] main oscillator trim for 5 v reg[1,e8] room temperature calibration for 5v hot temperature calibration for 5v ta b l e 2 ta b l e 3 m b mult m b mult 00h 01h table 4-11. checksum parameters (07h) name address description key1 0,f8h 3ah key2 0,f9h stack pointer value, when ssc is exe- cuted. blockid 0,fah number of flash blocks to calculate checksum on. table 4-12. calibrate0 parameters (08h) name address description key1 0,f8h 3ah key2 0,f9h stack pointer value, when ssc is exe- cuted. table 4-13. calibrate1 parameters (09h) name address description key1 0,f8h 3ah key2 0,f9h stack pointer value, when ssc is exe- cuted. pointer 0,fbh first of 32 sram addresses used by this function.
december 22, 2003 document no. 38-12009 rev. *d 49 cy8c22xxx preliminary data sheet 4. supervisory rom (srom) 4.2 register definitions 4.2.1 cpu_scr1 register the cpu_scr1 register is used to convey status and con- trol of events related to internal resets and watchdog reset. bits 7 to 1: reserved. bit 0: iramdis. the initialize ram disable bit is a control bit that is readable and writeable. the default value for this bit is 0, which indicates that the maximum amount of sram should be initialized on reset to a value of 00h. when the bit is set, the minimum amount of sram is initialized after a watchdog reset. for more information on this bit, see the ?srom function descriptions? on page 46 . for additional information, reference the cpu_scr1 regis- ter on page 143 . 4.3 clocking the values m, b, and mult are found in flash table 3. the user must supply a value for t, which is the ambient temper- ate in degrees celsius. the calculated value clock w is used for write operations, while clock e is used for erase operations. equation 1 equation 2 equation 2 is valid for cpu speeds from 3 mhz up to 12 mhz. the clock and delay parameters support flash opera- tions. the other clocking related parameter is ?delay.? for 12 mhz operation, the value is 56h. for other cpu speeds, the following equation may be used. equation 3 clock w clock e mult 64 ------------------------------------------ = clock e cpu 5648 ------------ b 12 10 6 -------------------- mt 1536 10 6 -------------------------- ? 89 ? ? = delay 100 10 6 ? () cpu 84 ? 13 ------------------------------------------------------------- =
4. supervisory rom (srom) cy8c22xxx preliminary data sheet 50 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 51 5. interrupt controller this chapter presents the interrupt controller and its associated registers. the interrupt controller provides a mechanism for a hardware resource in psoc mixed signal array devices to change program execution to a new address, without regard to the current task being performed by the code being executed. the interrupt controller and its associated registers allow the user?s code to respond to an interrupt from almost every functional block in the psoc devices. interrupts for all the digital blocks and each of the analog columns are available, as well as interrupts for supply voltage, sleep, variable clocks, and a general gpio (pin) interrupt. the registers associated with the interrupt controller allow interrupts to be disabled either globally or individually. the registers also provide a mechanism by which a user may clear all pending and posted interrupts, or clear individual posted or pending interrupts. a software mechanism is pro- vided to set individual interrupts. setting an interrupt by way of software is very useful during code development, when one may not have the complete hardware system necessary to generate a real interrupt. the following table lists all interrupts and the priorities that are available in the psoc device. table 5-1. interrupt controller registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access 0,dah int_clr0 vc3 sleep gpio analog 1 v monitor rw : 00 0,dbh int_clr1 dcb03 dcb02 dbb01 dbb00 rw : 00 0,ddh int_clr3 i2c rw : 00 0,deh int_msk3 enswint i2c rw : 00 0,e0h int_msk0 vc3 sleep gpio analog 1 v monitor rw : 00 0,e1h int_msk1 dcb03 dcb02 dbb01 dbb00 rw : 00 0,e2h int_vc pending interrupt[7:0] rc : 00 x,f7h cpu_f xoi carry zero gie rl : 00 legend l: the and, or, and xor flag instructions can be used to modify this register. c: cearable register or bits. x: an ?x? before the comma in the address field indicates that this register can be accessed or written to no matter what bank is used. table 5-2. cy8c22xxx interrupt table interrupt priority interrupt address interrupt name 0 (highest) 0000h reset 1 0004h supply voltage monitor 3 000ch analog column 1 6 0018h vc3 7 001ch gpio 8 0020h psoc block dbb00 9 0024h psoc block dbb01 10 0028h psoc block dcb02 11 002ch psoc block dcb03 24 0060h i2c 25 (lowest) 0064h sleep timer
5. interrupt controller cy8c22xxx preliminary data sheet 52 document no. 38-12009 rev. *d december 22, 2003 5.1 architectural description a block diagram of the psoc interrupt controller is shown in figure 5-1 . it illustrates the notion of posted and pending interrupts. figure 5-1. interrupt controller block diagram the sequence of events that occur during interrupt process- ing is as follows: 1. an interrupt becomes active, either because (a) the interrupt condition occurs (e.g., a timer expires), (b) a previously posted interrupt is enabled through an update of an interrupt mask register, or (c) an interrupt is pend- ing and gie is set from 0 to 1 in the cpu flag register. 2. the current executing instruction finishes. 3. the internal interrupt routine executes, taking 13 cycles. during this time, the following actions occur: ? the pch, pcl, and flag register (cpu_f) are pushed onto the stack (in that order). ? the cpu_f register is then cleared. since this clears the gie bit to 0, additional interrupts are temporarily disabled. ? the pch (pc[15:8]) is cleared to zero. ? the interrupt vector is read from the interrupt control- ler and its value placed into pcl (pc[7:0]). this sets the program counter to point to the appropriate address in the interrupt table (e.g., 001ch for the gpio interrupt). 4. program execution vectors to the interrupt table. typi- cally, a ljmp instruction in the interrupt table sends exe- cution to the user's interrupt service routine (isr) for this interrupt. 5. the isr executes. note that interrupts are disabled since gie = 0. in the isr, interrupts can be re-enabled if desired by setting gie = 1 (take care to avoid stack over- flow in this case). 6. the isr ends with a reti instruction. this pops the flag register, pcl, and pch from the stack, restoring those registers. the restored flag register re-enables inter- rupts, since gie = 1 again. 7. execution resumes at the next instruction, after the one that occurred before the interrupt. however, if there are more pending interrupts, the subsequent interrupts will be processed before the next normal program instruc- tion. interrupt latency. the time between the assertion of an enabled interrupt and the start of its isr can be calculated from the following equation. latency = time for current instruction to finish + time for internal interrupt routine to execute + time for ljmp instruction in interrupt table to execute. for example, if the 5-cycle jmp instruction is executing when an interrupt becomes active, the total number of cpu clock cycles before the isr begins would be as follows. (1 to 5 cycles for jmp to finish) + (13 cycles for interrupt routine) + (7 cycles for ljmp) = 21 to 25 cycles. in the example above, at 24 mhz, 25 clock cycles take 1.042 us. interrupt source (timer, gpio, etc.) interrupt taken or int_clrx write posted interrupt pending interrupt gie cpu_f[0] interrupt vector int_mskx mask bit setting d r q 1 priority encoder m8c core interrupt request . . . ...
december 22, 2003 document no. 38-12009 rev. *d 53 cy8c22xxx preliminary data sheet 5. interrupt controller 5.2 register definitions table 5-1 gives an overview of all registers related to inter- rupt controller operation. the following text presents details on the use of each register. 5.2.1 int_clrx register there are three interrupt clear registers (int_clr0, int_clr1, and int_clr3) which may be referred to in general as int_clrx. the int_clrx registers are similar to the int_mskx registers in that they hold a bit for each interrupt source. however, functionally the int_clrx regis- ters are similar to the int_vc register, although their opera- tion is completely independent. when an int_clrx register is read any bits that are set indicate an interrupt has been posted for that hardware resource. therefore, reading these registers gives the user the ability to determine all posted interrupts. the way an individual bit value written to an int_clrx reg- ister is interpreted is determined by the enable software interrupt (enswint) bit in int_msk3[7]. when enswint is cleared (the default state) writing 1's to an int_clrx reg- ister has no effect. however, writing 0's to an int_clrx reg- ister, when enswint is cleared, will cause the corresponding interrupt to be cleared. if the enswint bit is set, any 0's written to the int_clrx registers will be ignored. however, 1's written to an int_clrx register, while enswint is set, will cause an interrupt to be posted for the corresponding interrupt. enabling software interrupts allows a user's code to create software interrupts that can aid in debugging interrupt service routines, by eliminating the need to create the system level interactions that may be necessary to create a hardware interrupt. for additional information, reference the int_clr0 register on page 129 , the int_clr1 register on page 131 , and the int_clr3 register on page 132 . 5.2.2 int_mskx register there are three interrupt mask registers (int_msk0, int_msk1, and int_msk3) which may be referred to in general as int_mskx. if cleared, each bit in an int_mskx register prevents an interrupt from becoming a pending interrupt (input to the priority encoder). however, an inter- rupt may still post even if its mask bit is zero. all int_mskx bits are independent of all other int_mskx bits. if an int_mskx bit is set, the interrupt source associated with that mask bit may generate an interrupt that will become a pending interrupt. for example, if int_msk0[5] is set and at least one gpio pin is configured to generate an interrupt, the interrupt controller will allow a gpio interrupt request to post and become a pending interrupt for the m8c to respond to. if a higher priority interrupt is generated before the m8c responds to the gpio interrupt, the higher priority interrupt will be pending and not the gpio interrupt. int_msk3[7] (enswint) is a special non-mask bit that controls the behavior of the int_clrx registers. see the int_clrx reg- ister in this section for more information. each interrupt source may require configuration at a block level. refer to other chapters of this document for informa- tion on how to configure an individual interrupt source. for additional information, reference the int_msk0 register on page 134 , the int_msk1 register on page 135 , and the int_msk3 register on page 133 . 5.2.3 int_vc register the interrupt vector clear register (int_vc) performs two different functions. when the register is read, the least sig- nificant byte of the highest priority pending interrupt is returned. for example, if the gpio and i 2 c interrupts were pending and the int_vc register was read, the value 1ch would be read. however, if no interrupt were pending, the value 00h would be returned. this is the reset vector in the interrupt table; however, reading 00h from the int_vc reg- ister should not be considered to be an indication that a sys- tem reset is pending. rather, reading 00h from the int_vc register simply indicates that there are no pending inter- rupts. the highest priority interrupt, indicated by the value returned by a read of the int_vc register, is removed from the list of pending interrupts when the m8c performs an interrupt vector read (ivr). the clear of the highest priority pending interrupt occurs asynchronously. reading the int_vc has limited usefulness. if interrupts are enabled, a read to the int_vc register would not be able to determine that an interrupt was pending before the interrupt was actually taken. however, while in an interrupt, a user may wish to read the int_vc register to see what the next interrupt will be. when the int_vc register is written, with any value, all pending and posted interrupts are cleared by asserting the clear line for each interrupt. for additional information, reference the int_vc register on page 136 . 5.2.4 cpu_f register only the gie bit in the cpu_f register is related to the inter- rupt controller. this bit is the global interrupt enable. when this bit is set, the m8c will take a pending interrupt. when the gie bit is cleared, the m8c will not take any interrupts. by default, this bit is cleared. to set or clear this bit, the and f, e x p r, or or f, expr, or xor f, expr instructions must be used. (written another way: and / or /x or f, expr instruc- tions must be used.) the gie flag bit is covered in more detail in the chapter titled ?cpu core (m8c)? on page 35 . for additional information, reference the cpu_f register on page 142 .
5. interrupt controller cy8c22xxx preliminary data sheet 54 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 55 6. general purpose io ( gpio ) this chapter discusses the general purpose io (gpio) and its associated registers. the gpio blocks provide the interface between the m8c core and the outside world. they offer a large number of configurations to support several types of input/ output operations for both digital and analog systems. 6.1 architectural description the gpio contains input buffers, output drivers, register bit storage, and configuration logic for connecting the psoc device to the outside world. io ports are arranged with (up to) 8 bits per port. each full port contains eight identical gpio blocks, with connections to identify a unique address and register bit number for each block. therefore, the registers shown in tab l e 6 - 1 are actu- ally for a gpio port (eight gpio blocks), where the bit posi- tion indicates which of the eight gpio bit blocks is controlled in the gpio port. each gpio block can be used for the following types of io: digital io (digital io controlled by software) global io (digital psoc block io) analog io (analog psoc block io) each io pin also has several possible drive modes, as well as interrupt capabilities. while all gpio pins are identical and provide digital io, some pins may not connect internally for global or analog functions. the main block diagram for the gpio block is illustrated in figure 6-1 . note that some pins do not have all of the func- tionality shown, depending on internal connections. 6.1.1 digital io one of the basic operations of the gpio ports is to allow the m8c to send information out of the chip and get information into the m8c from outside the chip; this is accomplished by way of the port data register (prtxdr). writes from the m8c to the prtxdr store the data state, one bit per gpio. in the standard non-bypass mode, the pin drivers drive the pin in response to this data bit, with a drive strength deter- mined by the drive mode setting (see below). the actual voltage on the pin depends on the drive mode and the exter- nal load. the m8c may read the value of a port by reading the prtxdr. when the m8c reads the prtxdr, the current value of the pin voltage is translated into a logic value and returned to the m8c. these operations read the pin voltage, not the data drive state stored in the local prtxdr register bit latch. 6.1.2 global io the gpio ports are also used to interconnect signals to and from the digital psoc blocks, as global inputs or outputs. the global io feature of each gpio (port pin) is off by default. to access the feature, two parameters must be changed. to configure a gpio as a global input the port glo- bal select bit must be set for the desired gpio using the table 6-1. gpio registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access 0,xxh prtxdr data register rw : 00 0,xxh prtxie bit interrupt enables rw : 00 0,xxh prtxgs global select rw : 00 0,xxh prtxdm2 drive mode 2 rw : ff 1,xxh prtxdm0 drive mode 0 rw : 00 1,xxh prtxdm1 drive mode 1 rw : ff 1,xxh prtxic0 interrupt control 0 rw : 00 1,xxh prtxic1 interrupt control 1 rw : 00 legend xx: an ?x? after the comma in the address field indicates that there are multiple instances of the register. for an expanded ad dress listing of these registers, refer to the ?core register summary? on page 32 .
6. general purpose io (gpio) cy8c22xxx preliminary data sheet 56 document no. 38-12009 rev. *d december 22, 2003 prtxgs register. also, the drive mode for the gpio must be set to the digital hi-z state. (refer to ?prtxdmx regis- ters? on page 58 for more information.) to configure a gpio as a global output, the port global select bit must again be set. but in this case, the drive state must be set to any of the non-hi-z states. 6.1.3 analog io analog signals can pass between the chip core and chip pins through the block?s aout pin. this provides a resistive path (~300 ohms) directly through the block. for analog modes, the gpio block is typically configured into a high impedance analog drive mode (hi-z). 6.1.4 gpio block interrupts each gpio block can be individually configured for interrupt capability. blocks are configured by pin interrupt enables and also selection of the interrupt state. blocks can be set to interrupt when the pin is high, low, or when it changes from the last time it was read. the block provides an open-drain interrupt output (into) that is connected to other gpio blocks in a wire-or fashion. all pin interrupts that are wire-or?ed together are tied to the same system gpio interrupt. therefore, if interrupts are enabled on multiple pins, the user?s interrupt service routine must use some user designed mechanism, to determine which pin was the source of the interrupt. using a gpio interrupt requires the following steps: 1. set interrupt mode in the gpio pin block. 2. enable the bit interrupt in the gpio block. 3. set mask bit for the (global) gpio interrupt. 4. assert the overall global interrupt enable. these last two steps are common to all interrupts and are described in ?interrupt controller? on page 51 . the first two steps, bit interrupt enable and interrupt mode, are set at the gpio block level (i.e., at each port pin), by way of the block?s configuration registers. at the gpio block level, asserting the into line depends only on the bit interrupt enable and the state of the pin rela- tive to the chosen interrupt mode. at the chip level, due to their wire-or nature, the gpio interrupts are neither true edge-sensitive interrupts nor true level-sensitive interrupts. they could be considered edge-sensitive for asserting, but level-sensitive for release of the wire-or interrupt line. if no gpio interrupts are asserting, a gpio interrupt will occur whenever a gpio pin interrupt enable is set and the gpio pin transitions (if not already transitioned) appropri- ately high or low (to match the interrupt mode configuration). once this happens, the into line will pull low to assert the gpio interrupt. (this assumes the other system-level enables are on, such as setting the global gpio interrupt enable and the global interrupt enable.) note that setting the pin interrupt enable may immediately assert into, if the interrupt mode conditions are already being met at the pin. once into pulls low, it will continue to hold into low until one of these conditions changes: a.) the pin interrupt enable is cleared; b.) the voltage at pin transitions to the opposite state; c.) in interrupt-on-change mode, the gpio data regis- ter is read, thus setting the local interrupt level to the oppo- site state; or d.) the interrupt mode is changed so that the current pin state does not create an interrupt. once one of these conditions is met, the into releases. at this point, another gpio pin (or this pin again) could assert its into pin, pulling the common line low to assert a new interrupt. note the following behavior from this level-release feature. if one pin is asserting into and then a second pin asserts its into, when the first pin releases its into, the second pin is already driving into and thus no change will be seen, i.e., no new interrupt would be asserted on the gpio interrupt. care must be taken, using polling and/or the states of the gpio pin and global interrupt enables, to catch all interrupts among a set of wire-or gpio blocks.
december 22, 2003 document no. 38-12009 rev. *d 57 cy8c22xxx preliminary data sheet 6. general purpose io (gpio) figure 6-1. gpio block diagram dm[2:0]=110b r d en q reset i2c input global input bus qinlatch 5.6k vpwr write prtxdr 2:1 drive logic dm2 dm1 dm0 data 2:1 byp global output bus i2c output i2c enable slew control vpwr 5.6k pin (to readmux, interrupt logic) output path input path dm1 dm0 byp cellrd analog output analog input drive modes dm1 dm2 mode 0 0 0 resistive pull down dm0 0 0 1 strong drive 0 1 0 high impedence 0 1 1 resistive pull up 1 0 0 open drain, drives high 1 0 1 slow strong drive 1 1 0 high impedence analog 1 1 1 open drain, drives low data bus read prtxdr
6. general purpose io (gpio) cy8c22xxx preliminary data sheet 58 document no. 38-12009 rev. *d december 22, 2003 the interrupt logic portion of the block is shown in figure 6-2 . figure 6-2. gpio interrupt mode block diagram 6.2 register definitions for a selected gpio block, the individual registers are addressed as shown in tab l e 6 - 2 . in the register names, the ?x? is the port number, configured at the chip level (x = 0 to 7 typically). da[1:0] refers to the two lsb of the register address. all register values are readable, except for the prtxdr reg- ister; reads of this register return the pin state instead of the register bit state. 6.2.1 prtxdr registers writing the prtxdr register bit sets the output drive state for the pin to high (for din=1) or low (din=0), unless a bypass mode is selected (either i2c enable=1 or the global select register written high). reading prtxdr returns the actual pin state, as seen by the input buffer. this may not be the same as the expected output state, if the load pulls the pin more strongly than the pin?s configured output drive. for additional information, reference the prtxdr register on page 86 . 6.2.2 prtxie registers the prtxie register is used to enable/disable the interrupt enable internal to the gpio block. a ?1? enables the into output at the block, a ?0? disables into so it can only be hi- z. for additional information, reference the prtxie register on page 87 . 6.2.3 prtxgs registers the prtxgs register is used to select the block for connec- tion to global inputs or outputs. writing this register high enables the global bypass (byp=1 in figure 6-1 ). if the drive mode is set to digital hi-z (dm[2:0] = 010b), then the pin is selected for global input (pin drives to the global input bus). in non-hi-z modes, the block is selected for global output (the global output bus drives to pin), bypassing the data register value (assuming i2c enable=0). if the prtxgs register is written to zero, the global in/out function is disabled for the pin. for additional information, reference the prtxgs register on page 88 . 6.2.4 prtxdmx registers there are eight possible drive modes for each port pin. three mode bits are required to select one of these modes, and these three bits are spread into three different registers (prtxdm0, prtxdm1, and prtxdm2). the bit position of the effected port pin (example: pin[2] in port 0) is the same as the bit position of each of the three drive mode register bits that control the drive mode for that pin (example: bit[2] in prt0dm0, bit[2] in prt0dm1 and bit[2] in prt0dm2). the three bits from the three registers are treated as a group. these are referred to as dm2, dm1, and dm0, or falling ie rising change im1 im0 im1 im0 dq s r into im0 im1 inbuf interrupt logic cellrd en qinlatch interrupt mode im0 im1 output 0 0 disabled 0 1 low 10 high 1 1 change from last read table 6-2. internal register bit addressing xoi da[1:0] register resets to: (name) function 0 00b prtxdr 0 din data 0 01b prtxie 0 ie interrupt enable 0 10b prtxgs 0 byp global select 011bprtxdm2 1 dm2 drive mode, bit 2 1 00b prtxdm0 0 dm0 drive mode, bit 0 1 01b prtxdm1 1 dm1 drive mode, bit 1 1 10b prtxic0 0 im0 intrpt. mask, bit 0 1 11b prtxic1 0 im1 intrpt. mask, bit 1
december 22, 2003 document no. 38-12009 rev. *d 59 cy8c22xxx preliminary data sheet 6. general purpose io (gpio) together as dm[2:0]. drive modes are shown in ta b l e 6 - 3 . for analog io, the drive mode should be set to one of the hi-z modes, either 010b or 110b. the 110b mode has the advantage that the block?s digital input buffer is disabled, so no ?crowbar? current flows even when the analog input is not close to either power rail. when digital inputs are needed on the same pin as analog inputs, the 010b drive mode should be used. if the 110b drive mode is used, the pin will always be read as a zero by the cpu and the pin will not be able to generate a useful interrupt. (it is not strictly required that a hi-z mode be selected for analog operation). for global input modes, the drive mode must be set to 010b. this gpio provides a default drive mode of high impedance (hi-z). this is achieved by forcing the reset state of all prtxdm1 and prtxdm2 registers to ffh. the resistive drive modes place a resistance in series with the output, for low outputs (mode 000b) or high outputs (mode 011b). strong drive mode 001b gives the fastest edges at high dc drive strength. mode 101b gives the same drive strength but with slower edges. the open drain modes (100b and 111b) also use the slower edge rate drive. these modes enable open drain functions such as i 2 c mode 111b (although the slow edge rate is not slow enough to meet the i 2 c fast mode specification). for additional information, reference the prtxdm2 register on page 89 , the prtxdm0 register on page 145 , and the prtxdm1 register on page 146 . 6.2.5 prtxicx registers the interrupt mode for the pin is determined by bits in two registers: prtxic1 and prtxic0. these are referred to as im1 and im0, or together as im[1:0]. there are four possible interrupt modes for each port pin. two mode bits are required to select one of these modes and these two bits are spread into two different registers (prtxic0 and prtxic1). the bit position of the effected port pin (example: pin[2] in port 0) is the same as the bit position of each of the interrupt control register bits that control the interrupt mode for that pin (example: bit[2] in prt0ic0 and bit[2] in prt0ic1). the two bits from the two registers are treated as a group. the interrupt mode must be set to one of the non-zero modes listed in tab l e 6 - 4 , in order to get an interrupt from the pin. the gpio interrupt mode ?disabled? (00b) disables inter- rupts from the pin, even if the gpio?s bit interrupt enable is on (from the prtxie register). interrupt mode 01b means that the block will assert the interrupt line (into) when the pin voltage is low, providing the block?s bit interrupt enable line is set (high). interrupt mode 10b means that the block will assert the interrupt line (into), when the pin voltage is high, providing the block?s bit interrupt enable line is set (high). interrupt mode 11b means that the block will assert the inter- rupt line (into) when the pin voltage is the opposite of the last state read from the pin (again providing the block?s bit interrupt enable line is set high). this mode switches between low mode and high mode, depending on the last value that was read from the port during reads of the data register (prtxdr). if the last value read from the gpio was 0, the gpio will subsequently be in interrupt high mode. if the last value read from the gpio was 1, the gpio will then be in interrupt low mode. figure 6-3. gpio interrupt mode 11b figure 6-3 assumes that the gie is set, gpio interrupt mask is set, and that the gpio interrupt mode has been set to 11b. the change interrupt mode is different from the other modes, in that it relies on the value of the gpio?s read latch to determine if the pin state has changed. therefore, the port that contains the gpio in question must be read during table 6-3. pin drive modes drive mode dm[2:0] pin state description 000b resistive pull down strong high, resistive low 001b strong drive strong high, strong low 010b high impedance hi-z high and low, digital input enabled 011b resistive pull up resistive high, strong low 100b open drain high slow strong high, hi-z low 101b slow strong drive slow strong high, slow strong low 110b high impedance, analog ( reset state ) hi-z high and low, digital input dis- abled (for zero power) ( reset state ) 111b open drain low slow strong low, hi-z high table 6-4. gpio interrupt modes interrupt mode im[1:0] description 00b bit interrupt disabled, into de-asserted 01b assert into when pin = low 10b assert into when pin = high 11b assert into when pin = change from last read last value read from pin was 0 pin state waveform gpio pin interrupt enable set interrupt occurs (a) pin state waveform gpio pin interrupt enable set interrupt occurs (b) last value read from pin was 1 pin state waveform gpio pin interrupt enable set interrupt occurs (c) pin state waveform gpio pin interrupt enable set interrupt occurs (d)
6. general purpose io (gpio) cy8c22xxx preliminary data sheet 60 document no. 38-12009 rev. *d december 22, 2003 every interrupt service routine. if the port is not read, the interrupt mode will act as if it is in high mode when the latch value is 0 and low mode when the latch value is 1. for additional information, reference the prtxic0 register on page 147 and the prtxic1 register on page 148 .
december 22, 2003 document no. 38-12009 rev. *d 61 7. analog output drivers this chapter presents the analog output drivers and its associated register. the analog output drivers provide a means for driving analog signals off-chip. 7.1 architectural description the psoc device has one analog driver used to output ana- log values. for a detailed drawing of the analog output driv- ers in relation to the analog system, reference the analog input configuration chapter on page 235 . figure 7-1. analog output drivers the psoc device has one analog driver used to output ana- log values on port pins. this driver is a resource available to all the analog blocks in the column. the user can select one analog block per column to drive a signal on its analog out- put bus (abus), to serve as the input to the analog driver for that column. the output from the analog output driver for the column can be enabled and disabled using the analog out- put driver register abf_cr0. 7.2 register definitions tab l e 7 - 1 presents an overview of all registers related to the analog output drivers. the following section presents a detail on the use of the register?s bits. 7.2.1 abf_cr0 register this register controls analog input muxes from port 0, and the output buffer amplifiers that drive column outputs to device pins. bit 7: acol1mux. a mux selects the output of column 0 input mux or column 1 input mux. when set, this bit sets the column 1 input to column 0 input mux output. bit 6: reserved. bit 5: abuf1en0. this bit enables or disables the column output amplifiers. bits 4, 3, and 2: reserved. bit 1: bypass. bypass mode connects the amplifier input directly to the output. when this bit is set, all amplifiers con- trolled by the register will be in bypass mode. bit 0: pwr. this bit is used to set the power level of the amplifiers. when this bit is set, all amplifiers controlled by the register will be in a high power. for additional information, reference the abf_cr0 register on page 156 . table 7-1. analog output driver register address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access 1,62h abf_cr0 acol1mux abuf1en0 bypass pwr rw : 00 array p0[5] acb01 asd11 asc21
7. analog output drivers cy8c22xxx preliminary data sheet 62 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 63 8. internal main oscillator ( imo ) this chapter briefly presents the internal main oscillator (imo) and its associated register. the imo produces clock signals of 24 mhz and 48 mhz. 8.1 architectural description the internal main oscillator outputs two clocks: a sysclk, which can be the internal 24 mhz clock or an external clock, and a sysclk2x that is always twice the sysclk fre- quency. in the absence of a high-precision input source from the 32 khz crystal oscillator, the accuracy of the internal 24 mhz/48 mhz clocks will be +/-2.5% over temperature varia- tion and two voltage ranges (3.3v +/-.3v and 5.0v +/-5%). no external components are required to achieve this level of accuracy. there is an option to phase lock this oscillator to the exter- nal crystal oscillator. the choice of crystal and its inherent accuracy will determine the overall accuracy of the oscilla- tor. the external crystal oscillator must be stable prior to locking the frequency of the internal main oscillator to this reference source. the imo can be disabled when using an external clocking source. also, the frequency doubler circuit, which produces sysclk2x, can be disabled to save power. note that when using an external clock, if sysclk2x is needed, then the imo can not be disabled. registers for controlling these operations are found in the digital clocks chapter on page 253 . 8.2 register definitions 8.2.1 imo_tr register the device specific value for 5 volt operation is loaded into the internal main oscillator trim register (imo_tr) at boot time. the internal main oscillator will operate within speci- fied tolerance over a voltage range of 4.75v to 5.25v, with no modification of this register. if the device is operated at a lower voltage, user code must modify the contents of this register. for operation in the voltage range of 3.3v +/-.3v, this can be accomplished with a table read command to the supervisor rom, which will supply a trim value for oper- ation in this range. for operation between these voltage ranges, user code can interpolate the best value using both available factory trim values. bits 7 to 0: trim. these bits are used to trim the internal main oscillator. a larger value in this register will increase the speed of the oscillator. for additional information, reference the imo_tr register on page 170 . table 8-1. internal main oscillator register address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access 1,e8h imo_tr trim[7:0] w : 00
8. internal main oscillator (imo) cy8c22xxx preliminary data sheet 64 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 65 9. internal low speed oscillator ( ilo ) this chapter briefly explains the internal low speed oscillator (ilo) and its associated register. the internal low speed oscillator produces a 32 khz clock. 9.1 architectural description the internal low speed oscillator is an internal low speed oscillator of nominally 32 khz. it is available to generate sleep wake-up interrupts and watchdog resets. this oscilla- tor can also be used as a clocking source for the digital psoc blocks. the oscillator operates in three modes: normal power, low power, and off. the normal power mode consumes more current to produce a more accurate frequency. the low power mode is always used when the part is in a power down (sleep) state and can be selected during non-sleep, but provides less frequency accuracy. 9.2 register definitions 9.2.1 ilo_tr register this register sets the adjustment for the ilo. the device specific value, placed in the trim bits of this register at boot time, is based on factory testing. it is strongly recommended that the user not alter the register value. bits 7 and 6: reserved. bits 5 and 4: bias trim. two bits are used to set the bias current in the ptat current source. bit 5 gets inverted, so that a medium bias is selected when both bits are 0. the bias current is set according to tab l e 9 - 2 . bits 3 to 0: freq trim. four bits are used to trim the fre- quency. bit 0 is the lsb, bit 3 is the msb. bit 3 gets inverted inside the register; therefore, a code of 8h turns all current sources off (f=0 khz), a code of 0h turns only the msb cur- rent source on (f=mid-scale), and a code of 7h turns on all the current sources (f=max). for additional information, reference the ilo_tr register on page 171 . table 9-1. internal low speed oscillator register address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access 1,e9h ilo_tr bias trim[1:0] freq trim[3:0] w : 00 table 9-2. bias current in ptat bias current bit 5 bit 4 medium bias 00 maximum bias 01 minimum bias 10 not needed * 11 * about 15% higher than the minimum bias.
9. internal low speed oscillator (ilo) cy8c22xxx preliminary data sheet 66 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 67 10. 32 khz crystal oscillator ( eco ) this chapter briefly explains the 32 khz crystal oscillator (eco) and its associated register. the 32 khz crystal oscillator ci r- cuit allows the user to replace the internal low speed oscillator with a more precise time source at low cost and low power. 10.1 architectural description the crystal oscillator circuit uses an inexpensive watch crys- tal and two small valued load capacitors as external compo- nents. all other components are on the psoc chip. the crystal oscillator may be configured to provide a reference to the internal main oscillator in pll mode for generating a more accurate 24 mhz system clock. the xtalin and xtalout pins support connection of a 32.768 khz watch crystal. to run from the external crystal, bit 7 of the oscillator control 0 register (osc_cr0) must be set (default is off). the only external components are the crystal and the two load capacitors that connect to vdd. transitions between the internal and external oscillator domains may produce glitches on the clock bus. during the process of activating the eco, there must be a hold-off period before using it as the 32 khz source. this hold off period is partially implemented in hardware using the sleep timer. firmware must set up a sleep period of one second (maximum eco settling time), and then enable the eco in the osc_cr0 register. at the one second time-out (the sleep interrupt), the switch is made by hardware to the eco. if the eco is subsequently deactivated, the ilo will again be activated and the switch is made back to the ilo immediately. the firmware steps involved in switching between the inter- nal low speed oscillator to the 32 khz crystal oscillator are as follows. 1. at reset, the chip begins operation, using the internal low speed oscillator. 2. select sleep interval of 1 second using bits[4:3] in the oscillator control 0 register (osc_cr0), as the oscilla- tor stabilization interval. 3. enable the 32 khz crystal oscillator, by setting bit [7] in oscillator control 0 register (osc_cr0) to 1. 4. the 32 khz crystal oscillator becomes the selected source, at the end of the one-second interval on the edge created by the sleep interrupt logic. the one-sec- ond interval gives the oscillator time to stabilize, before it becomes the active source. the sleep interrupt need not be enabled for the switch-over to occur. reset the sleep timer (if this does not interfere with any ongoing real-time clock operation), to guarantee the interval length. note that the internal low speed oscillator contin- ues to run, until the oscillator is automatically switched over by the sleep timer interrupt. 5. it is strongly advised to wait the one-second stabilization period prior to engaging the pll mode to lock the inter- nal main oscillator frequency to the 32 khz crystal oscillator frequency. note 1 the internal low speed oscillator switches back instantaneously by writing the 32k select control bit to zero. note 2 if the proper settings are selected in psoc designer, the above steps are automatically done in boot.asm . note 3 transitions between oscillator domains may pro- duce glitches on the 32k clock bus. functions that require accuracy on the 32k clock should be enabled after the tran- sition in oscillator domains. table 10-1. crystal oscillator register address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access 1,e0h osc_cr0 32k select pll mode no buzz sleep[1:0] cpu speed[2:0] rw : 00 1,ebh eco_tr pssdc[1:0] w : 00 x,feh cpu_scr1 iramdis rw:00
10. 32 khz crystal oscillator (eco) cy8c22xxx preliminary data sheet 68 document no. 38-12009 rev. *d december 22, 2003 10.1.1 eco external components the external crystal oscillator component connections and selections are illustrated in figure 10-1 . figure 10-1. external crystal oscillator connections crystal ? 32.768 khz watch crystal such as edson c- 002rx. capacitors ? c1, c2 use npo ceramic caps. use the equation below if you do not employ pll mode. c1 = c2 = 25 pf - (package cap) - (board parasitic cap) if you do employ pll with the external crystal oscillator, see application note an2027 under support at http://www.cypress.com/ for equation and details. an error of 1 pf in c1 and c2 gives about a 3 ppm error in frequency. 10.2 register definitions 10.2.1 osc_cr0 register bit 7: 32k select. by default, the 32 khz clock source is the internal low-speed oscillator (ilo). optionally, the external crystal oscillator (eco) may be selected. bit 6: pll mode. this is the only bit in the osc_cr0 reg- ister that directly influences the pll. when set, this bit enables the pll. the extclken bit in the osc_cr2 reg- ister should be set low during pll operation. bit 5: no buzz. normally, when the sleep bit is set in the cpu_scr register, all chip systems are powered down, including the band gap reference. however, to facilitate the detection of por and lvd events at a rate higher than the sleep interval, the band gap circuit is powered up periodi- cally for about 60 us at the sleep system duty cycle (set in eco_tr), which is independent of the sleep interval and typically higher. when the no buzz bit is set, the sleep sys- tem duty cycle value is overridden, and the band gap cir- cuit is forced to be on during sleep. this results in faster response to an lvd or por event (continuous detection as opposed to periodic), at the expense of slightly higher aver- age sleep current. bits 4 and 3: sleep[1:0]. the available sleep interval selections are shown in table 10-3 . it must be remembered that when the ilo is the selected 32 khz clock source, sleep intervals are approximate. bits 2, 1 and 0: cpu speed[2:0]. the psoc m8c may operate over a range of cpu clock speeds ( ta bl e 1 0 - 4 ), allowing the m8c?s performance and power requirements to be tailored to the application. the reset value for the cpu speed bits is zero. therefore, the default cpu speed is one-eighth of the clock source. the internal main oscillator is the default clock source for the cpu speed circuit; therefore, the default cpu speed is 3 mhz. the cpu frequency is changed with a write to the osc_cr0 register. there are eight frequencies generated from a power-of-2 divide circuit, which are selected by a 3- bit code. at any given time, the cpu 8:1 clock multiplexer is selecting one of the available frequencies, which is re-syn- chronized to the 24 mhz master clock at the output. table 10-2: typical package capacitance on crystal pins package package capacitance 8 pdip 2.8 pf 8 soic 2.0 pf 20 pdip 3.0 pf 20 ssop 2.6 pf 20 soic 2.5 pf 32 mlf 2.0 pf xtalin p1[1] xtalout p1[0] crystal vdd c2 vdd c1 table 10-3. sleep interval selections sleep interval osc_cr[4:3] sleep timer clocks sleep period (nominal) watchdog period (nominal) 00b (default) 64 1.95 ms 6 ms 01b 512 15.6 ms 47 ms 10b 4096 125 ms 375 ms 11b 32,768 1 sec 3 sec
december 22, 2003 document no. 38-12009 rev. *d 69 cy8c22xxx preliminary data sheet 10. 32 khz crystal oscillator (eco) regardless of the cpu speed bit?s setting, if the actual cpu speed is greater than 12 mhz, the 24 mhz operating requirements apply. an example of this scenario is a device that is configured to use an external clock, which is supply- ing a frequency of 20 mhz. if the cpu speed register?s value is 0b011, the cpu clock will be 20 mhz. therefore, the supply voltage requirements for the device are the same as if the part was operating at 24 mhz off of the internal main oscillator. the operating voltage requirements are not relaxed until the cpu speed is at 12.0 mhz or less. for additional information, reference the osc_cr0 register on page 165 . 10.2.2 eco_tr register the external crystal oscillator trim register (eco_tr) sets the adjustment for the external crystal oscillator. the device specific value placed in this register at boot time is based on factory testing. this register does not adjust the frequency of the external crystal oscillator. it is recom- mended that the user not alter the bits in this register. bits 7 and 6: pssdc[1:0]. these bits are used to set the sleep duty cycle. bits 5 to 0: reserved. for additional information, reference the eco_tr register on page 173 . 10.2.3 cpu_scr1 register the cpu_scr1 register is used to convey status and con- trol of events related to internal resets and watchdog reset. bits 7 to 1: reserved. bit 0: iramdis. the initialize ram disable bit is a control bit that is readable and writeable. the default value for this bit is 0, which indicates that the maximum amount of sram should be initialized on reset to a value of 00h. when the bit is set, the minimum amount of sram is initialized after a watchdog reset. for more information on this bit, see the ?srom function descriptions? on page 46 . for additional information, reference the cpu_scr1 regis- ter on page 143 . table 10-4. osc_cr0[2:0] bits: cpu speed bits internal main oscillator external clock 000b 3 mhz extclk/ 8 001b 6 mhz extclk/ 4 010b 12 mhz extclk/ 2 011b 24 mhz extclk/ 1 100b 1.5 mhz extclk/ 16 101b 750 khz extclk/ 32 110b 187.5 khz extclk/ 128 111b 93.7 khz extclk/ 256
10. 32 khz crystal oscillator (eco) cy8c22xxx preliminary data sheet 70 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 71 11. phase locked loop ( pll ) this chapter briefly presents the phase locked loop (pll) and its associated registers. 11.1 architectural description a phase-locked loop (pll) function generates the system clock with crystal accuracy. it is designed to provide a 23.986 mhz oscillator when utilized with an external 32.768 khz crystal. although the pll tracks crystal accuracy, it requires time to lock onto the reference frequency when first starting. the length of time depends on the pllgain controlled by bit 7 of the osc_cr2 register. if this bit is held low, the lock time will be less than 10 ms. if this bit is held high, the lock time will be on the order of 50 ms. after lock is achieved, it is rec- ommended that this bit be forced high to decrease the jitter on the output. if longer lock time is tolerable, the pllgain bit can be held high all the time. after the external crystal oscillator has been selected and enabled, the following procedure should be followed to enable the pll and allow for proper frequency lock. select a cpu frequency of 3 mhz or less. enable the pll. wait between 10 and 50 ms, depending on the osc_cr2 register bit 7. set cpu to a faster frequency, if desired. to do this, write the bits cpu speed[2:0] in the osc_cr0 register. the cpu frequency will immediately change when these bits are set. if the proper settings are selected in psoc designer, the above steps are automatically done in boot.asm. 11.2 register definitions 11.2.1 osc_cr0 register bit 7: 32k select. by default, the 32 khz clock source is the internal low-speed oscillator (ilo). optionally, the external crystal oscillator (eco) may be selected. bit 6: pll mode. this is the only bit in the osc_cr0 reg- ister that directly influences the pll. when set, this bit enables the pll. the extclken bit in the osc_cr2 reg- ister should be set low during pll operation. bit 5: no buzz. normally, when the sleep bit is set in the cpu_scr register, all chip systems are powered down, including the band gap reference. however, to facilitate the detection of por and lvd events at a rate higher than the sleep interval, the band gap circuit is powered up periodi- cally for about 60 us at the sleep system duty cycle (set in eco_tr), which is independent of the sleep interval and typically higher. when the no buzz bit is set, the sleep sys- tem duty cycle value is overridden, and the band gap cir- cuit is forced to be on during sleep. this results in faster response to an lvd or por event (continuous detection as opposed to periodic), at the expense of slightly higher aver- age sleep current. bits 4 and 3: sleep[1:0]. the available sleep interval selections are shown in table 11-2 . it must be remembered that when the ilo is the selected 32 khz clock source, sleep intervals are approximate. table 11-1. phase locked loop registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access 1,e0h osc_cr0 32k select pll mode no buzz sleep[1:0] cpu speed[2:0] rw : 00 1,e2h osc_cr2 pllgain extclken imodis sysclkx2 dis rw : 00
11. phase locked loop (pll) cy8c22xxx preliminary data sheet 72 document no. 38-12009 rev. *d december 22, 2003 bits 2, 1, and 0: cpu speed[2:0]. the psoc m8c may operate over a range of cpu clock speeds ( ta bl e 11 - 3 ), allowing the m8c?s performance and power requirements to be tailored to the application. the reset value for the cpu speed bits is zero. therefore, the default cpu speed is one-eighth of the clock source. the internal main oscillator is the default clock source for the cpu speed circuit; therefore, the default cpu speed is 3 mhz. the cpu frequency is changed with a write to the osc_cr0 register. there are eight frequencies generated from a power-of-2 divide circuit, which are selected by a 3- bit code. at any given time, the cpu 8:1 clock multiplexer is selecting one of the available frequencies, which is re-syn- chronized to the 24 mhz master clock at the output. regardless of the cpu speed bit?s setting, if the actual cpu speed is greater than 12 mhz, the 24 mhz operating requirements apply. an example of this scenario is a device that is configured to use an external clock, which is supply- ing a frequency of 20 mhz. if the cpu speed register?s value is 0b011, the cpu clock will be 20 mhz. therefore, the supply voltage requirements for the device are the same as if the part was operating at 24 mhz off of the internal main oscillator. the operating voltage requirements are not relaxed until the cpu speed is at 12.0 mhz or less. for additional information, reference the osc_cr0 register on page 165 . 11.2.2 osc_cr2 register bit 7: pllgain. this is the only bit in the osc_cr2 regis- ter that directly influences the pll. when set, this bit keeps the pll in a low gain mode. bits 6 to 3: reserved. bit 2: extclken. when the extclken bit is set, the external clock becomes the source for the internal clock tree, sysclk, which drives most chip clocking functions. all external and internal signals, including the 32 khz clock, whether derived from the internal low speed oscillator (ilo) or the crystal oscillator, are synchronized to this clock source. if an external clock is enabled, pll mode should be off. bit 1: imodis. when set, the internal main oscillator is dis- abled. if the doubler is enabled (sysclkx2dis=0), the internal main oscillator will be forced on. bit 0: sysclkx2dis. when set, the internal main oscilla- tor?s doubler is disabled. this will result in a reduction of overall device power, on the order of 1 ma. it is advised that any application that does not require this doubled clock should have it turned off. for additional information, reference the osc_cr2 register on page 167 . table 11-2. sleep interval selections sleep interval osc_cr[4:3] sleep timer clocks sleep period (nominal) watchdog period (nominal) 00b (default) 64 1.95 ms 6 ms 01b 512 15.6 ms 47 ms 10b 4096 125 ms 375 ms 11b 32,768 1 sec 3 sec table 11-3. osc_cr0[2:0] bits: cpu speed bits internal main oscillator external clock 000b 3 mhz extclk/ 8 001b 6 mhz extclk/ 4 010b 12 mhz extclk/ 2 011b 24 mhz extclk/ 1 100b 1.5 mhz extclk/ 16 101b 750 khz extclk/ 32 110b 187.5 khz extclk/ 128 111b 93.7 khz extclk/ 256
december 22, 2003 document no. 38-12009 rev. *d 73 12. sleep and watchdog this chapter discusses the sleep and watchdog operations and its associated registers. the goal of sleep operation is to reduce average power con- sumption as much as possible. the system has a sleep state that can be initiated under firmware control. in this state, the cpu is stopped at an instruction boundary and the 24/48 mhz oscillator, the flash memory module, and band- gap-voltage reference are powered down. the only blocks that remain in operation are the 32 khz oscillator (external crystal or internal), psoc blocks clocked from the 32 khz clock selection, and the supply voltage monitor circuit. analog psoc blocks have individual power down settings that are controlled by firmware, independently of the sleep state. continuous time analog blocks may remain in opera- tion, since they do not require a clock source. typically, however, switched capacitor analog blocks will not operate since the internal sources of clocking for these blocks are stopped. the system can only wake up from sleep as a result of an interrupt or reset event. the sleep timer can provide peri- odic interrupts to allow the system to wake up, poll peripher- als, or do real-time functions and then go to sleep again. gpio (pin) interrupts, supply monitor interrupt, analog col- umn interrupts, and timers clocked externally or from the 32 khz clock are examples of asynchronous interrupts that can also be used to wake the system up. the watchdog timer (wdt) circuit is designed to assert a hardware reset to the device after a pre-programmed inter- val, unless it is periodically serviced in firmware. this func- tionality serves to reboot the system in the event of a cpu crash. it can also restart the system from the cpu halt state. once the wdt is enabled, it can only be disabled by an external reset (xres) or a power on reset (por). a wdt reset will leave the wdt enabled. therefore, if the wdt is used in an application, all code (including initialization code) must be written as though the wdt is enabled. 12.1 architectural description device components that are involved in sleep and watchdog operation are the selected 32 khz clock (external crystal or internal), the sleep timer, the sleep bit in the cpu_scr0 register, the sleep circuit (to sequence going into and com- ing out of sleep), the band gap refresh circuit (to periodically refresh the reference voltage during sleep), and the watch- dog timer. 12.1.1 32 khz clock selection by default, the 32 khz clock source is the internal low- speed oscillator (ilo). optionally, the external crystal oscillator (eco) may be activated. this selection is made in bit 7 of the osc_cr0 register. selecting the eco as the active source for the 32 khz clock allows the sleep timer and sleep interrupt to be used in real-time applications. regardless of the clock source selected, the 32 khz clock plays a key role in sleep functionality. it runs continuously table 12-1. sleep and watchdog registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access 0,e0h int_msk0 vc3 sleep gpio analog 1 v monitor rw : 00 0,e3h res_wdt wdsl_clear w : 00 x,feh cpu_scr1 eco exw eco ex iramdis rw : 00 1,e0h osc_cr0 32k select pll mode no buzz sleep[1:0] cpu speed[2:0] rw : 00 1,e9h ilo_tr bias trim[1:0] freq trim[3:0] w : 00 1,ebh eco_tr pssdc[1:0] w : 00 x,ffh cpu_scr0 gies wdrs pors sleep stop w : xx legend x: the value for power on reset is unknown. x: an ?x? before the comma in the address field indicates that this register can be accessed or written to no matter what bank is used. *: this bit is read only.
12. sleep and watchdog cy8c22xxx preliminary data sheet 74 document no. 38-12009 rev. *d december 22, 2003 and is used to sequence system wakeup. it is also used to periodically refresh the bandgap voltage during sleep. 12.1.2 sleep timer the sleep timer is a 15-bit, up counter clocked by the cur- rently selected 32 khz clock source, either the ilo or eco. this timer is always enabled. the exception to this is within an ice (in-circuit emulator) in debugger mode and the stop bit in the cpu_scr0 is set; the sleep timer is disabled, so that the user will not get continual watchdog resets when a breakpoint is hit in the debugger environment. if the associated sleep timer interrupt is enabled, a periodic interrupt to the cpu is generated based on the sleep inter- val selected from the osc_cr0 register. the sleep timer functionality does not need to be directly associated with sleep state. it can be used as a general-purpose timer inter- rupt regardless of sleep state. the reset state of the sleep timer is a count value of all zeros. there are two ways to reset the sleep timer. any hardware reset, i.e., power-on reset (por), external reset (xres) or watchdog reset (wdr) will reset the sleep timer. there is also a method that allows the user to reset the sleep timer in firmware. a write of 38h to the res_wdt register clears the sleep timer. (note: any write to res_wdt register also clears the watchdog timer.) clear- ing the sleep timer may be done at anytime to synchronize the sleep timer operation to cpu processing. a good exam- ple of this is after por. the cpu hold-off due to voltage ramp, etc., may be significant. in addition, a significant amount of program initialization may be required. however, the sleep timer starts counting immediately after por and will be at an arbitrary count when user code begins execu- tion. in this case, it may be desirable to clear the sleep timer before enabling the sleep interrupt initially, to ensure that the first sleep period will be a full interval. 12.1.3 sleep bit sleep is initiated in firmware by setting the sleep bit (bit 3) in the system control register (cpu_scr0). to wake up the system, this register bit is cleared asynchronously by any enabled interrupt. however, there are two special features of this register bit that ensures proper sleep operation. first, the write to set the register bit is blocked, if an interrupt is about to be taken on that instruction boundary (immediately after the write. second, there is a hardware interlock to ensure that once set, the sleep bit may not be cleared by an incoming interrupt until the sleep circuit has finished per- forming the sleep sequence and that the system wide power down signal has been asserted. this prevents the sleep cir- cuit from being interrupted in the middle of the process of system power down, possibly leaving the system in an inde- terminate state. 12.2 application description the following are notes regarding sleep as it relates to firm- ware and application issues. 1. if an interrupt is pending, enabled, and scheduled to be taken at the instruction boundary after the write to the sleep bit, the system will not go to sleep. the instruction will still execute, but it will not be able to set the sleep bit in the cpu_scr0 register. instead, the interrupt will be taken and the effect of the sleep instruction is ignored. 2. the global interrupt enable (cpu_f register) does not need to be enabled to wake the system out of sleep state. individual interrupt enables, as set in the interrupt mask registers, are sufficient. if the global interrupt enable is not set, the cpu will not service the isr asso- ciated with that interrupt. however, the system will wake up and continue executing instructions from the point at which it went to sleep. in this case, the user must manu- ally clear the pending interrupt or subsequently enable the global interrupt enable bit and let the cpu take the isr. if a pending interrupt is not cleared, it will be contin- uously asserted, and although the sleep bit may be writ- ten and the sleep sequence executed, as soon as the device enters sleep mode, the sleep bit will be cleared by the pending interrupt and sleep mode will be exited. 3. on wake up, the instruction immediately after the sleep instruction will be executed before the interrupt service routine (if enabled). the instruction after the sleep instruction is pre-fetched before the system actually goes to sleep. therefore, when an interrupt occurs to wake the system up, the pre-fetched instruction is exe- cuted and then the interrupt service routine is executed. (if the global interrupt enable is not set, instruction exe- cution will just continue where it left off before sleep). 4. if pll mode is enabled, cpu frequency must be reduced to 3 mhz before going to sleep. since the pll will overshoot as it attempts to re-lock after wakeup, the cpu frequency must be relatively low. it is recom- mended to wait 10 ms after wakeup, before normal cpu operating frequency may be restored. 5. analog power must be turned off by firmware, before going to sleep. the system sleep state does not control the analog array. there are individual power controls for each analog block and global power controls in the refer- ence block. these power controls must be manipulated by firmware. 6. if the global interrupt enable bit is disabled, it can be safely enabled just before the instruction that writes the sleep bit. it is usually undesirable to get an interrupt on the instruction boundary, just before writing the sleep bit. this means that on the return from interrupt, the sleep command will be executed, possibly bypassing any firm- ware preparations that need to be made in order to go to sleep. to prevent this, disable interrupts before prepara- tions are made. after sleep preparations, enable global interrupts and write the sleep bit with the two consecu- tive instructions as follows.
december 22, 2003 document no. 38-12009 rev. *d 75 cy8c22xxx preliminary data sheet 12. sleep and watchdog and f,~01h // disable global interrupts (prepare for sleep, could be many instructions) or f,01h // enable global interrupts mov reg[ffh],08h // set the sleep bit due to the timing of the global interrupt enable instruc- tion, it is not possible for an interrupt to occur immedi- ately after that instruction. the earliest the interrupt could occur is after the next instruction (write to the sleep bit) has been executed. therefore, if an interrupt is pending, the sleep instruction will be executed; but as described in #1, the sleep instruction will be ignored. the first instruc- tion executed after the isr will be the instruction after sleep. 12.3 register definitions 12.3.1 int_msk0 register the int_msk0 register holds bits that are used by several different resources. the digital clocks only use bit 7 of the int_msk0 register for the vc3 clock and bits zero through six are used by other resources. the sleep bit (bit 6) con- trols whether the sleep timer may be used as an interrupt source. for a full discussion of the int_msk0 register, see the interrupt controller chapter on page 51 . for additional information, reference the int_msk0 register on page 134 . 12.3.2 res_wdt register this write-only register has two functions. a write of any value will clear the watchdog timer. a write of 38h will clear both the watchdog timer (wdt) and the sleep timer. it is important to recall that the wdt is designed to timeout at 3 rollover events of the sleep timer. therefore, if only the wdt is cleared, the next watchdog reset will occur any- where from two to three times the current sleep interval set- ting. if the sleep timer is near the beginning of its count, the wd timeout will be closer to three times. however, if the sleep timer is very close to its terminal count, the wd time- out will be closer to two times. to ensure a full three times timeout, both the wdt and the sleep timer may be cleared. in applications that need a real-time clock, and thus cannot reset the sleep timer when clearing the wdt, the duty cycle at which the wdt must be cleared should be no greater than two times of the sleep interval. for additional information, reference the res_wdt register on page 137 . 12.3.3 osc_cr0 register bit 7: 32k select. by default, the 32 khz clock source is the internal low-speed oscillator (ilo). optionally, the external crystal oscillator (eco) may be selected. bit 6: pll mode. this is the only bit in the osc_cr0 reg- ister that directly influences the pll. when set, this bit enables the pll. the extclken bit in the osc_cr2 reg- ister should be set low during pll operation. bit 5: no buzz. normally, when the sleep bit is set in the cpu_scr register, all chip systems are powered down, including the band gap reference. however, to facilitate the detection of por and lvd events at a rate higher than the sleep interval, the band gap circuit is powered up periodi- cally for about 60 us at the sleep system duty cycle (set in eco_tr), which is independent of the sleep interval and typically more frequent. when the no buzz bit is set, the sleep system duty cycle value is overridden, and the band gap circuit is forced to be on during sleep. this results in faster response to an lvd or por event (continuous detec- tion as opposed to periodic), at the expense of slightly higher average sleep current. bits 4 and 3: sleep[1:0]. the available sleep interval selections are shown in table 12-2 . it must be remembered that when the ilo is the selected 32 khz clock source, sleep intervals are approximate. bits 2, 1, and 0: cpu speed[2:0]. the psoc m8c may operate over a range of cpu clock speeds ( table 12-3 ), allowing the m8c?s performance and power requirements to be tailored to the application. the reset value for the cpu speed bits is zero. therefore, the default cpu speed is one-eighth of the clock source. the internal main oscillator is the default clock source for the cpu speed circuit; therefore, the default cpu speed is 3 mhz. see ?external clock? on page 254 for more informa- tion on the supported frequencies for externally supplied clocks. the cpu frequency is changed with a write to the osc_cr0 register. there are eight frequencies generated from a power-of-2 divide circuit, which are selected by a 3- bit code. at any given time, the cpu 8:1 clock multiplexer is selecting one of the available frequencies, which is re-syn- chronized to the 24 mhz master clock at the output. regardless of the cpu speed bit?s setting, if the actual cpu speed is greater than 12 mhz, the 24 mhz operating requirements apply. an example of this scenario is a device that is configured to use an external clock, which is supply- ing a frequency of 20 mhz. if the cpu speed register?s value is 011b, the cpu clock will be 20 mhz. therefore, the supply voltage requirements for the device are the same as if the part was operating at 24 mhz off of the internal main table 12-2. sleep interval selections sleep interval osc_cr[4:3] sleep timer clocks sleep period (nominal) watchdog period (nominal) 00b (default) 64 1.95 ms 6 ms 01b 512 15.6 ms 47 ms 10b 4096 125 ms 375 ms 11b 32,768 1 sec 3 sec
12. sleep and watchdog cy8c22xxx preliminary data sheet 76 document no. 38-12009 rev. *d december 22, 2003 oscillator. the operating voltage requirements are not relaxed until the cpu speed is at 12.0 mhz or less. for additional information, reference the osc_cr0 register on page 165 . 12.3.4 cpu_scr1 register this register contains bits (3 and 2) that ensure high watch- dog reset integrity. since the 32 khz oscillator source may be programmatically switched between the eco and ilo, the switch-over must only be allowed to occur if the external crystal system actually exists. these bits are not reset by a watchdog reset event. bits 7 to 1: reserved. bit 0: iramdis. the initialize ram disable bit is a control bit that is readable and writeable. the default value for this bit is 0, which indicates that the maximum amount of sram should be initialized on reset to a value of 00h. when the bit is set, the minimum amount of sram is initialized after a watchdog reset. for more information on this bit, see the ?srom function descriptions? on page 46 . for additional information, reference the cpu_scr1 regis- ter on page 143 . 12.3.5 ilo_tr register this register sets the adjustment for the ilo. the device specific value, placed in the trim bits of this register at boot time, is based on factory testing. it is strongly recommended that the user not alter the register value. bits 7 and 6: reserved. bits 5 and 4: bias trim. bits 3 to 0: freq trim. four bits are used to trim the fre- quency. the value is set in the factory and should not be changed. for additional information, reference the ilo_tr register on page 171 . 12.3.6 eco_tr register the external crystal oscillator trim register (eco_tr) sets the adjustment for the external crystal oscillator. the value placed in this register is based on factory testing. this regis- ter does not adjust the frequency of the external crystal oscillator. it is recommended that the user does not alter the bits in this register. bits 7 and 6: pssdc[1:0]. these bits are used to set the sleep duty cycle. bits 5 to 0: reserved. for additional information, reference the eco_tr register on page 173 . 12.3.7 cpu_scr0 register the bits of the cpu_scr0 register are used to convey sta- tus and control of events for various functions of a psoc device. bit 7: gies. the global interrupt enable status bit is a read only status bit and its use is discouraged. the gies bit is a legacy bit which was used to provide the ability to read the gie bit of the cpu_f register. however, the cpu_f reg- ister is now readable. when this bit is set, it indicates that the gie bit in the cpu_f register is also set which, in turn, indicates that the microprocessor will service interrupts. bit 6: reserved. bit 5: wdrs. the watchdog reset status bit is normally zero, but set whenever a watchdog reset occurs. the bit is readable and clearable by writing a zero to its bit position in the cpu_scr0 register. this bit may not be set. bit 4: pors. the power-on reset status (pors) bit and watchdog enable bit will be set automatically by a por or external reset. if the bit is cleared by user code, the watch- dog timer will be enabled. once cleared, the only way to reset the pors bit is to go through a por or external reset. thus, there is no way to disable the watchdog timer, other than to go through a por or external reset. bit 3: sleep. the sleep bit is used to enter low power sleep mode when set, as described in this chapter. bits 2 and 1: reserved. bit 0: stop. the stop bit is readable and writeable. when set, the psoc m8c will stop executing code until a reset event occurs. this can be either a por, watchdog reset, or external reset. if an application wants to stop code execution until a reset, the preferred method would be to use the halt instruction rather than a register write to this bit. for additional information, reference the cpu_scr0 regis- ter on page 144 . table 12-3. osc_cr0[2:0] bits: cpu speed bits internal main oscillator external clock 000b 3 mhz extclk/ 8 001b 6 mhz extclk/ 4 010b 12 mhz extclk/ 2 011b 24 mhz extclk/ 1 100b 1.5 mhz extclk/ 16 101b 750 khz extclk/ 32 110b 187.5 khz extclk/ 128 111b 93.7 khz extclk/ 256
december 22, 2003 document no. 38-12009 rev. *d 77 cy8c22xxx preliminary data sheet 12. sleep and watchdog 12.4 timing diagrams 12.4.1 sleep sequence the sleep bit is an input into the sleep logic circuit. this circuit is designed to sequence the device into and out of the hardware sleep state. the hardware sequence to put the device to sleep is shown in figure 12-1 and is defined as fol- lows. 1. firmware sets the sleep bit in the cpu_scr0 register. the bus request (brq) signal to the cpu is immedi- ately asserted. this is a request by the system to halt cpu operation at an instruction boundary. 2. due to the specific timing of the register write, the cpu issues a bus request acknowledge (bra) on the follow- ing positive edge of the cpu clock. 3. the sleep logic waits for the following negative edge of the cpu clock and then asserts a system-wide power down (pd) signal. in figure 12-1 , the cpu is halted and the system-wide power down signal is asserted. the system-wide pd (power down) signal controls three major circuit blocks: the flash memory module, the internal main oscillator (24/48 mhz oscillator, or imo), and the band- gap voltage reference. these circuits transition into a zero power state. the only operational circuits on chip are the ilo (or optional eco), the bandgap refresh circuit, and the supply voltage monitor circuit. note that the system sleep state does not apply to the analog array. power down set- tings for individual analog blocks and references must be done in firmware, prior to executing the sleep instruction. figure 12-1. sleep sequence iow sleep brq bra pd on the falling edge of cpuclk, pd is asserted. the 24/48 mhz system clock is halted, the flash and bandgap are powered down. cpuclk cpu captures brq on next cpuclk edge. firmware write to scr sleep bit causes an immediate brq. cpu responds with a bra.
12. sleep and watchdog cy8c22xxx preliminary data sheet 78 document no. 38-12009 rev. *d december 22, 2003 12.4.2 wake up sequence once asleep, the only event that can wake the system up is an interrupt. the global interrupt enable of the cpu flag reg- ister does not need to be set. any unmasked interrupt will wake the system up. it is optional for the cpu to actually take the interrupt after the wakeup sequence. the wake up sequence is synchronized to the 32 khz clock for purposes of sequencing a startup delay, to allow the flash memory module enough time to power up before the cpu asserts the first read access. another reason for the delay is to allow the imo, bandgap, and lvd/por circuits time to settle before actually being used in the system. as shown in figure 12-2 , the wake up sequence is as follows. 1. the wake up interrupt occurs and is synchronized by the negative edge of the 32 khz clock. 2. at the following positive edge of the 32 khz clock, the system wide pd signal is negated. the flash memory module, imo, and bandgap circuit are all powered up to a normal operating state. 3. at the following positive edge of the 32 khz clock, the current values for the precision por and lvd have set- tled and are sampled. 4. at the following negative edge of the 32 khz clock (after about 15 s, nominal), the brq signal is negated by the sleep logic circuit. on the following cpuclk, bra is negated by the cpu and instruction execution resumes. note that in figure 12-2 fixed function clocks, such as flash, imo, and bandgap, have about 15 s to start up. the wake-up times (interrupt to cpu operational) will range from 75 to 105 s. figure 12-2. wakeup sequence clk32k int sleep pd cpuclk/ 24 mhz brq bra cpu sleep timer or gpio interrupt occurs. cpu is restarted after 90 ms (nominal). (not to scale) bandgap lvd ppor enable sample interrupt is double sampled by 32k clock and pd is negated to system. sample lvd/por lvd/ppor is valid
december 22, 2003 document no. 38-12009 rev. *d 79 cy8c22xxx preliminary data sheet 12. sleep and watchdog 12.4.3 bandgap refresh during normal operation, the bandgap circuit provides a voltage reference (vref) to the system, for use in the ana- log blocks, flash, and low voltage detect (lvd) circuitry. normally, the bandgap output is connected directly to the vref signal. however, during sleep, the bandgap reference generator block and lvd circuits are completely powered down. the bandgap and lvd blocks are periodically re- enabled during sleep in order to monitor for low voltage con- ditions. this is accomplished by turning on the bandgap periodically, allowing it time to start up for a full 32k clock period and connecting it to vref to refresh the reference voltage for the following 32k clock period as shown in figure 12-3 . during the second 32k clock period of the refresh cycle, the lvd circuit is allowed to settle during the high time of the 32k clock. during the low period of the second 32k clock, the lvd interrupt is allowed to occur. figure 12-3. bandgap refresh operation the rate at which the refresh occurs is related to the 32 khz clock and controlled by the power system sleep duty cycle (pddsc, bits [7:6] of the eco_tr register). table 12-4 enu- merates the available selections. the default setting (128 sleep timer counts) is applicable for many applications, giv- ing a typical average device current under 5 a. 12.4.4 watchdog timer (wdt) on device boot up, the wdt is initially disabled. the pors bit in the system control register controls the enabling of the wdt. on boot, the pors bit is initially set to '1', indicating that either a por or xres event has occurred. the wdt is enabled by clearing the pors bit. once this bit is cleared and the watchdog timer is enabled, it cannot be subse- quently disabled (the pors bit cannot be set to '1' in firm- ware, it can only be cleared). the only way to disable the watchdog function, after it is enabled, is through a subse- quent por or xres. although the wdt is disabled during the first time through initialization code after a por or xres, all code should be written as if it is enabled (i.e., the wdt should be cleared periodically). this is because, in the initialization code after a wdr event, the watchdog timer is enabled, so all code must be cognizant of this. the watchdog timer is three counts of the sleep timer inter- rupt output and therefore, the watchdog interval is three times the selected sleep timer interval. the available selec- tions for the watchdog interval are shown in table 12-2 . when the sleep timer interrupt is asserted, the watchdog timer increments. when the counter reaches three, a termi- nal count is asserted. this terminal count is registered by the 32 khz clock. therefore, the wdr (watchdog reset) signal will go high after the following edge of the 32 khz clock and be held asserted for 1 cycle (30us nominal). the flip-flop that registers the wdt terminal count is not reset by the wdr signal when it is asserted, but is reset by all other resets. this timing is shown in figure 12-4 . figure 12-4. watchdog reset once enabled, the wdt must be periodically cleared in firm- ware. this is accomplished with a write to the res_wdt register. this write is data independent, so any write will clear the watchdog timer. (note: a write of 38h will also clear the sleep timer). if for any reason the firmware fails to clear the wdt within the selected interval, the circuit will assert wdr to the device. wdr is equivalent in effect to any other reset. all internal registers are set to their reset state. an important aspect to remember about wdt resets is that ram initialization can be disabled (iramdis in cpu_scr1). in this case, the sram contents are unaf- fected, so that when a wdr occurs, program variables are persistent through this reset. in practical application, it is important to know that the watchdog timer interval can be anywhere between two and three times the sleep timer interval. the only way to guar- antee that the wdt interval is a full 3x of the sleep interval is to clear the sleep timer (write 38h) when clearing the wdt register. however, this is not possible in applications table 12-4. power system sleep duty cycle selections pssdc sleep timer counts period (nominal) 00b (default) 256 8 ms 01b 1024 31.2 ms 10b 64 2 ms 11b 16 500 us clk32k band gap vref bandgap is turned on, but not yet connected to vref. vref is slowly leaking to ground. bandgap output is connected to vref. voltage is refreshed. bandgap is powered down until next refresh cycle. low voltage monitors are active during clk32 low. sleep int wd reset (wdr) clk32k 2 wd count 3 0
12. sleep and watchdog cy8c22xxx preliminary data sheet 80 document no. 38-12009 rev. *d december 22, 2003 that use the sleep timer as a real-time clock. in the case where firmware clears the wdt register without clearing the sleep timer, this can occur at any point in a given sleep timer interval. if it occurs just before the terminal count of a sleep timer interval, the resulting wdt interval will be just over 2x of the sleep timer interval. 12.5 power consumption sleep mode power consumption consists of the following items. the typical block currents shown do not represent maximums. these currents do not include any analog block currents that may be on during sleep mode. while the clk32 can be turned off in sleep, this mode is not useful since it makes it impossible to restart unless an ipor reset occurs. (the sleep bit can?t be cleared without clk32.) during the sleep mode buzz, the band-gap is on for two cycles and the lvd circuitry is on for one cycle. time- averaged currents from periodic sleep mode ?buzz?, with periodic count of n, are listed in table 12-6 . table 12-7 lists example currents for n=256 and n=1024. device leakage currents add to the totals in the table. table 12-5. continuous currents ipor 1 ua iclk32 (ilo/eco) 1 ua table 12-6. time-averaged currents ibg (band-gap) (2/n) * 60 ua ilvd (lvd comparators) (2/n) * 50 ua table 12-7. example currents n=256 n=1024 ipor 1 1 clk32 1 1 ibg 0.46 0.12 ilvd 0.4 0.1 total 2.9 ua 2.2 ua
december 22, 2003 document no. 38-12009 rev. *d 81 section c register reference the register reference section discusses the registers of the psoc device. it lists all the registers in mapping tables, in off - set order. for easy reference, each register is linked to a detailed description located in the following chapter. this section encompasses the following chapter: register details on page 85 register conventions the register conventions specific to this section and the register details chapter are listed in the following table. register mapping tables the psoc device has a total register address space of 512 bytes. the register space is also referred to as io space and is broken into two parts. the xoi bit in the flag register determines which bank the user is currently in. when the xoi bit is set, the user is said to be in the ?extended? address space or the ?configuration? registers. convention description empty, grayed-out table cell illustrates a reserved bit or group of bits. ?x? before the comma in an address indicates the register exists in register bank 1 and register bank 2. ?x? in a register name indicates that there are multiple instances/address ranges of the same register. rw read and write register or bit(s) r read register or bit(s) w write register or bit(s) l logical register or bit(s) c clearable register or bit(s) # access is bit specific
section c register reference cy8c22xxx preliminary data sheet 82 document no. 38-12009 rev. *d december 22, 2003 register map 0 table: user space name addr (0,hex) access page name addr (0,hex) access page name addr (0,hex) access page name addr (0,hex) access page prt0dr 00 rw 86 40 80 c0 prt0ie 01 rw 87 41 81 c1 prt0gs 02 rw 88 42 82 c2 prt0dm2 03 rw 89 43 83 c3 prt1dr 04 rw 86 44 asd11cr0 84 rw 114 c4 prt1ie 05 rw 87 45 asd11cr1 85 rw 115 c5 prt1gs 06 rw 88 46 asd11cr2 86 rw 116 c6 prt1dm2 07 rw 89 47 asd11cr3 87 rw 117 c7 08 48 88 c8 09 49 89 c9 0a 4a 8a ca 0b 4b 8b cb 0c 4c 8c cc 0d 4d 8d cd 0e 4e 8e ce 0f 4f 8f cf 10 50 90 d0 11 51 91 d1 12 52 92 d2 13 53 93 d3 14 54 asc21cr0 94 rw 110 d4 15 55 asc21cr1 95 rw 111 d5 16 56 asc21cr2 96 rw 112 i2c_cfg d6 rw 125 17 57 asc21cr3 97 rw 113 i2c_scr d7 # 126 18 58 98 i2c_dr d8 rw 127 19 59 99 i2c_mscr d9 # 128 1a 5a 9a int_clr0 da rw 129 1b 5b 9b int_clr1 db rw 131 1c 5c 9c dc 1d 5d 9d int_clr3 dd rw 132 1e 5e 9e int_msk3 de rw 133 1f 5f 9f df dbb00dr0 20 # 90 amx_in 60 rw 101 a0 int_msk0 e0 rw 134 dbb00dr1 21 w 91 61 a1 int_msk1 e1 rw 135 dbb00dr2 22 rw 92 62 a2 int_vc e2 rc 136 dbb00cr0 23 # 93 arf_cr 63 rw 102 a3 res_wdt e3 w 137 dbb01dr0 24 # 90 cmp_cr0 64 # 103 a4 dec_dh e4 rc 138 dbb01dr1 25 w 91 asy_cr 65 # 104 a5 dec_dl e5 rc 139 dbb01dr2 26 rw 92 cmp_cr1 66 rw 105 a6 dec_cr0 e6 rw 140 dbb01cr0 27 # 93 67 a7 dec_cr1 e7 rw 141 dcb02dr0 28 # 90 68 a8 e8 dcb02dr1 29 w 91 69 a9 e9 dcb02dr2 2a rw 92 6a aa ea dcb02cr0 2b # 93 6b ab eb dcb03dr0 2c # 90 6c ac ec dcb03dr1 2d w 91 6d ad ed dcb03dr2 2e rw 92 6e ae ee dcb03cr0 2f # 93 6f af ef 30 70 rdi0ri b0 rw 118 f0 31 71 rdi0syn b1 rw 119 f1 32 72 rdi0is b2 rw 120 f2 33 73 rdi0lt0 b3 rw 121 f3 34 acb01cr3 74 rw 106 rdiolt1 b4 rw 122 f4 35 acb01cr0 75 rw 107 rdi0ro0 b5 rw 123 f5 36 acb01cr1 76 rw 108 rdi0ro1 b6 rw 124 f6 37 acb01cr2 77 rw 109 b7 cpu_f f7 rl 142 38 78 b8 f8 39 79 b9 f9 3a 7a ba fa 3b 7b bb fb 3c 7c bc fc 3d 7d bd fd 3e 7e be cpu_scr1 fe # 143 3f 7f bf cpu_scr0 ff # 144 blank fields are reserved and should not be accessed. # access is bit specific. refer to indicated page for details.
december 22, 2003 document no. 38-12009 rev. *d 83 cy8c22xxx preliminary data sheet section c register reference register map 1 table: configuration space name addr (1,hex) access page name addr (1,hex) access page name addr (1,hex) access page name addr (1,hex) access page prt0dm0 00 rw 145 40 80 c0 prt0dm1 01 rw 146 41 81 c1 prt0ic0 02 rw 147 42 82 c2 prt0ic1 03 rw 148 43 83 c3 prt1dm0 04 rw 145 44 asd11cr0 84 rw 114 c4 prt1dm1 05 rw 146 45 asd11cr1 85 rw 115 c5 prt1ic0 06 rw 147 46 asd11cr2 86 rw 116 c6 prt1ic1 07 rw 148 47 asd11cr3 87 rw 117 c7 08 48 88 c8 09 49 89 c9 0a 4a 8a ca 0b 4b 8b cb 0c 4c 8c cc 0d 4d 8d cd 0e 4e 8e ce 0f 4f 8f cf 10 50 90 gdi_o_in d0 rw 159 11 51 91 gdi_e_in d1 rw 160 12 52 92 gdi_o_ou d2 rw 161 13 53 93 gdi_e_ou d3 rw 162 14 54 asc21cr0 94 rw 110 d4 15 55 asc21cr1 95 rw 111 d5 16 56 asc21cr2 96 rw 112 d6 17 57 asc21cr3 97 rw 113 d7 18 58 98 d8 19 59 99 d9 1a 5a 9a da 1b 5b 9b db 1c 5c 9c dc 1d 5d 9d dd 1e 5e 9e osc_cr4 de rw 163 1f 5f 9f osc_cr3 df rw 164 dbb00fn 20 rw 149 clk_cr0 60 rw 154 a0 osc_cr0 e0 rw 165 dbb00in 21 rw 151 clk_cr1 61 rw 155 a1 osc_cr1 e1 rw 166 dbb00ou 22 rw 152 abf_cr0 62 rw 156 a2 osc_cr2 e2 rw 167 23 63 a3 vlt_cr e3 rw 168 dbb01fn 24 rw 149 64 a4 vlt_cmp e4 r 169 dbb01in 25 rw 151 65 a5 e5 dbb01ou 26 rw 152 amd_cr1 66 rw 157 a6 e6 27 alt_cr0 67 rw 158 a7 e7 dcb02fn 28 rw 149 68 a8 imo_tr e8 w 170 dcb02in 29 rw 151 69 a9 ilo_tr e9 w 171 dcb02ou 2a rw 152 6a aa bdg_tr ea rw 172 2b 6b ab eco_tr eb w 173 dcb03fn 2c rw 149 6c ac ec dcb03in 2d rw 151 6d ad ed dcb03ou 2e rw 152 6e ae ee 2f 6f af ef 30 70 rdi0ri b0 rw 118 f0 31 71 rdi0syn b1 rw 119 f1 32 72 rdi0is b2 rw 120 f2 33 73 rdi0lt0 b3 rw 121 f3 34 acb01cr3 74 rw 106 rdiolt1 b4 rw 122 f4 35 acb01cr0 75 rw 107 rdi0ro0 b5 rw 123 f5 36 acb01cr1 76 rw 108 rdi0ro1 b6 rw 124 f6 37 acb01cr2 77 rw 109 b7 cpu_f f7 rl 142 38 78 b8 f8 39 79 b9 f9 3a 7a ba fa 3b 7b bb fb 3c 7c bc fc 3d 7d bd fd 3e 7e be cpu_scr1 fe # 143 3f 7f bf cpu_scr0 ff # 144 blank fields are reserved and should not be accessed. # access is bit specific. refer to indicated page for details.
section c register reference cy8c22xxx preliminary data sheet 84 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 85 13. register details this chapter details all the psoc device registers in offset order for bank 0 and bank 1. the registers that are in both banks are incorporated with the bank 0 registers, designated with at least one ?x? in the register name and offset. bank 0 registers are listed first and begin on page 86 . bank 1 registers are listed second and begin on page 145 . if you need a condensed view of all the registers, reference the ?register mapping tables? on page 81 . the conventions specific to the registers in this chapter are listed below. table 13-1: register conventions convention example description ?x? in a register name acbxxcr1 multiple instances/address ranges of the same register. rw rw : 00 read and write register or bit(s) r r : 00 read register or bit(s) w w : 00 write register or bit(s) l rl : 00 logical register or bit(s) c rc : 00 clearable register or bit(s) 00 rw : 00 reset value is 0x00 or 00h xx rw : xx register is not reset 0, 0,04h register is in bank 0 1, 1, 23h register is in bank 1 x, x,f7h register exists in register bank 0 and register bank 1 empty, grayed-out table cell reserved bit or group of bits
13. register details cy8c22xxx preliminary data sheet 86 document no. 38-12009 rev. *d december 22, 2003 13.1 bank 0 registers the following registers are all in bank 0 and are listed in offset order. 13.1.1 prtxdr port data register for additional information, reference the ?register definitions? on page 58 in the gpio chapter. [7:0] data input[7:0] write value to port or read value from port. reads return the state of the pin, not the value in the prtxdr register. individual register names and addresses prt0dr : 0,00h prt1dr : 0,04h 7 6 5 4 3 2 1 0 access : por rw : 00 bit name data input[7:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 87 cy8c22xxx preliminary data sheet 13. register details 13.1.2 prtxie port interrupt enable register for additional information, reference the ?register definitions? on page 58 in the gpio chapter. [7:0] interrupt enables[7:0] a bit set in this register will enable the corresponding port pin interrupt. 0 port pin interrupt disabled for the corresponding pin. 1 port pin interrupt enabled for the corresponding pin. individual register names and addresses prt0ie : 0,01h prt1ie : 0,05h 7 6 5 4 3 2 1 0 access : por rw : 00 bit name interrupt enables[7:0] bit name description
13. register details cy8c22xxx preliminary data sheet 88 document no. 38-12009 rev. *d december 22, 2003 13.1.3 prtxgs port global select register for additional information, reference the ?register definitions? on page 58 in the gpio chapter. [7:0] global select[7:0] a bit set in this register will connect the corresponding port pin to the internal global busses. this con- nection is used to input or output digital signals to or from the digital blocks. 0 global function disabled, pin value determined by prtxdr bit value and port configuration registers. 1 global function enabled. direction depends on mode bits for the pin (registers prtxdm0, prtxdm1, prtxdm2). individual register names and addresses prt0gs : 0,02h prt1gs : 0,06h 7 6 5 4 3 2 1 0 access : por rw : 00 bit name global select[7:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 89 cy8c22xxx preliminary data sheet 13. register details 13.1.4 prtxdm2 port drive mode bit 2 register in register prtxdm2 there are eight possible drive modes for each port pin. three mode bits are required to select one of these modes, and these three bits are spread into three different registers ( ?prtxdm0? on page 145 , ?prtxdm1? on page 146 , and prtxdm2). the bit position of the effected port pin (example: pin[2] in port 0) is the same as the bit position of each of the three drive mode register bits that control the drive mode for that pin (example: bit[2] in prt0dm0, bit[2] in prt0dm1 and bit[2] in prt0dm2). the three bits from the three registers are treated as a group. these are referred to as dm2, dm1, and dm0, or together as dm[2:0]. all drive mode bits are shown in the sub-table below ([ 2 10] refers to the combination (in order) of bits in a given bit position); however, this register only controls the most significant bit of the drive mode. for additional information, reference the ?regis- ter definitions? on page 58 in the gpio chapter. [7:0] drive mode 2[7:0] bit 2 of the drive mode, for each of an 8-port pin, for a gpio port. [2 10 ] pin output high pin output low notes 000b strong resistive 001b strong strong 010b hi-z hi-z digital input enabled. 011b resistive strong 100b slow + strong hi-z 101b slow + strong slow + strong 110b hi-z hi-z digital input disabled for zero power. reset state. 111b hi-z slow + strong i 2 c compatible mode. individual register names and addresses prt0dm2 : 0,03h prt1dm2 : 0,07h 7 6 5 4 3 2 1 0 access : por rw : ff bit name drive mode 2[7:0] bit name description
13. register details cy8c22xxx preliminary data sheet 90 document no. 38-12009 rev. *d december 22, 2003 13.1.5 dxbxxdr0 digital basic/communication type b block data register 0 the function of this register is dependant on the function its block has been configured for (selected in the fn[2:0] bits of t he dxbxxfn register on page 149 ). for the timer, counter, dead band, and crcprs functions, a read of the dxbxxdr0 regis- ter returns 00h and transfers dxbxxdr0 to dxbxxdr2. for additional information, reference the ?register definitions? on page 198 in the digital blocks chapter. [7:0] data[7:0] data for selected function. block function register function timer count value counter count value dead band count value crcprs linear feedback shift register (lfsr) spim shifter spis shifter txuart shifter rxuart shifter individual register names and addresses dbb00dr0 : 0,20h dbb01dr0 : 0,24h dcb02dr0 : 0,28h dcb03dr0 : 0,2ch 7 6 5 4 3 2 1 0 access : por r : 00 bit name data[7:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 91 cy8c22xxx preliminary data sheet 13. register details 13.1.6 dxbxxdr1 digital basic/communication type b block data register 1 the function of this register is dependant on the function its block has been configured for (selected in the fn[2:0] bits of t he dxbxxfn register on page 149 ). for additional information, reference the ?register definitions? on page 198 in the digital blocks chapter. [7:0] data[7:0] data for selected function. block function register function timer period counter period dead band period crcprs polynomial spim tx buffer spis tx buffer txuart tx buffer rxuart not applicable individual register names and addresses dbb00dr1 : 0,21h dbb01dr1 : 0,25h dcb02dr1 : 0,29h dcb03dr1 : 0,2dh 7 6 5 4 3 2 1 0 access : por w : 00 bit name data[7:0] bit name description
13. register details cy8c22xxx preliminary data sheet 92 document no. 38-12009 rev. *d december 22, 2003 13.1.7 dxbxxdr2 digital basic/communication type b block data register 2 the function of this register is dependant on the function its block has been configured for (selected in the fn[2:0] bits of t he dxbxxfn register on page 149 . for additional information, reference the ?register definitions? on page 198 in the digital blocks chapter. [7:0] data[7:0] data for selected function. block function register function timer capture/compare counter compare dead band buffer crcprs seed/residue spim rx buffer spis rx buffer txuart not applicable rxuart rx buffer individual register names and addresses dbb00dr2 : 0,22h dbb01dr2 : 0,26h dcb02dr2 : 0,2ah dcb03dr2 : 0,2eh 7 6 5 4 3 2 1 0 access : por rw : 00 bit name data[7:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 93 cy8c22xxx preliminary data sheet 13. register details 13.1.8 dxbxxcr0 (timer control) digital basic/communication type b block control register 0 for additional information, reference the ?register definitions? on page 198 in the digital blocks chapter. [7:3] reserved [2] tc pulse width primary output 0 terminal count pulse width is one-half a block clock. supports a period value of 00h. 1 terminal count pulse width is one full block clock. [1] capture int 0 interrupt is selected with mode bit 0 in the function (dxbxxfn) register. 1 block interrupt is caused by a hardware capture event (overrides mode bit 0 selection). [0] enable 0 timer is not enabled. 1 timer is enabled. individual register names and addresses dbb00cr0 : 0,23h dbb01cr0 : 0,27h dcb02cr0 : 0,2bh dcb03cr0 : 0,2fh 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 bit name tc pulse width capture int enable bit name description
13. register details cy8c22xxx preliminary data sheet 94 document no. 38-12009 rev. *d december 22, 2003 13.1.9 dxbxxcr0 (counter control) digital basic/communication type b block control register 0 for additional information, reference the ?register definitions? on page 198 in the digital blocks chapter. [7:1] reserved [0] enable 0 counter is not enabled. 1 counter is enabled. individual register names and addresses dbb00cr0: 0,23h dbb01cr0: 0,27h dcb02cr0: 0,2bh dcb03cr0: 0,2fh 7 6 5 4 3 2 1 0 access : por rw : 0 bit name enable bit name description
december 22, 2003 document no. 38-12009 rev. *d 95 cy8c22xxx preliminary data sheet 13. register details 13.1.10 dxbxxcr0 (dead band control) digital basic/communication type b block control register 0 for additional information, reference the ?register definitions? on page 198 in the digital blocks chapter. [7:3] reserved [2] bit bang clock when bit bang mode is enabled, the output of this register bit is substituted for the pwm reference. this register may be toggled by user firmware to generate phi1 and ph2 output clocks with the pro- grammed dead time. [1] bit bang mode 0 dead band generator uses the previous block primary output as the input reference. 1 dead band generator uses the bit bang clock register as the input reference. [0] enable 0 dead band generator is not enabled. 1 dead band generator is enabled. individual register names and addresses dbb00cr0: 0,23h dbb01cr0: 0,27h dcb02cr0: 0,2bh dcb03cr0: 0,2fh 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 bit name bit bang clock bit bang mode enable bit name description
13. register details cy8c22xxx preliminary data sheet 96 document no. 38-12009 rev. *d december 22, 2003 13.1.11 dxbxxcr0 (crcprs control) digital basic/communication type b block control register 0 for additional information, reference the ?register definitions? on page 198 in the digital blocks chapter. [7:2] reserved [1] pass mode the data input selection is driven directly to the primary output and the block interrupt output. the clk input selection is driven directly to the auxiliary output. 0 normal crc/prs outputs 1 outputs are overridden. [0] enable 0 crc/prs is not enabled. 1 crc/prs is enabled. individual register names and addresses dbb00cr0: 0,23h dbb01cr0: 0,27h dcb02cr0: 0,2bh dcb03cr0: 0,2fh 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 bit name pass mode enable bit name description
december 22, 2003 document no. 38-12009 rev. *d 97 cy8c22xxx preliminary data sheet 13. register details 13.1.12 dcbxxcr0 (spim control) digital communication type b block control register 0 the lsb first, clock phase, and clock polarity bit are configuration bits and should never be changed once the block is enabled. they can be set at the same time that the block is enabled. for additional information, reference the ?register defi- nitions? on page 198 in the digital blocks chapter. [7] lsb first this bit should not be changed during an spi transfer. 0 data is shifted out msb first. 1 data is shifted out lsb first. [6] overrun 0 no overrun has occurred. 1 overrun has occurred. indicates that a new byte has been received and loaded into the rx buffer before the previous one could be read. cleared on read of this (cr0) register. [5] spi complete 0 indicates that a byte may still be in the process of shifting out, or no transmission is active. 1 indicates that a byte has been shifted out and all associated clocks have been generated. cleared on read of this (cr0) register. optional interrupt. [4] tx reg empty the reset state and the state when the block is disabled is ?1?. 0 indicates that a byte is currently buffered in the tx register. 1 indicates that a byte can be written to the tx register. cleared on write of the tx buffer (dr1) register. default interrupt. this status will initially be asserted on block enable; how- ever, the tx reg empty interrupt will occur only after the first data byte is written and trans- ferred into the shifter. [3] rx reg full 0 rx register is empty. 1 a byte has been received and loaded into the rx register. cleared on read of the rx buffer (dr2) register. [2] clock phase 0 data is latched on the leading edge of the clock. data changes on the trailing edge (modes 0,1). 1 data changes on the leading edge of the clock. data is latched on the trailing edge (modes 2,3). [1] clock polarity 0 non-inverted, clock idles low (modes 0,2). 1 inverted, clock idles high (modes 1,3). [0] enable 0 spi master is not enabled. 1 spi master is enabled. individual register names and addresses dcb02cr0: 0,2bh dcb03cr0: 0,2fh 7 6 5 4 3 2 1 0 access : por rw : 0 r : 0 r : 0 r : 1 r : 0 rw : 0 rw : 0 rw : 0 bit name lsb first overrun spi complete tx reg empty rx reg full clock phase clock polarity enable bit name description
13. register details cy8c22xxx preliminary data sheet 98 document no. 38-12009 rev. *d december 22, 2003 13.1.13 dcbxxcr0 (spis control) digital communication type b block control register 0 the lsb first, clock phase, and clock polarity bit are configuration bits and should never be changed once the block is enabled. they can be set at the same time that the block is enabled. for additional information, reference the ?register defi- nitions? on page 198 in the digital blocks chapter. [7] lsb first this bit should not be changed during an spi transfer. 0 data is shifted out msb first. 1 data is shifted out lsb first. [6] overrun 0 no overrun has occurred. 1 overrun has occurred. indicates that a new byte has been received and loaded into the rx buffer before the previous one could be read. cleared on read of this (cr0) register. [5] spi complete 0 indicates that a byte may still be in the process of shifting out or no transmission is active. 1 indicates that a byte has been shifted out and all associated clocks have been generated. cleared on read of this (cr0) register. optional interrupt. [4] tx reg empty the reset state and the state when the block is disabled is ?1?. 0 indicates that a byte is currently buffered in the tx register. 1 indicates that a byte can be written to the tx register. cleared on write of the tx buffer (dr1) register. default interrupt. this status will initially be asserted on block enable; how- ever, the tx reg empty interrupt will occur only after the first data byte is written and trans- ferred into the shifter. [3] rx reg full 0 rx register is empty. 1 a byte has been received and loaded into the rx register. cleared on read of the rx buffer (dr2) register. [2] clock phase 0 data is latched on the leading edge of the clock. data changes on the trailing edge. 1 data changes on the leading edge of the clock. data is latched on the trailing edge. [1] clock polarity 0 non-inverted, clock idles low. 1 inverted, clock idles high. [0] enable 0 spi slave is not enabled. 1 spi slave is enabled. individual register names and addresses dcb02cr0: 0,2bh dcb03cr0: 0,2fh 7 6 5 4 3 2 1 0 access : por rw : 0 r : 0 r : 0 r : 1 r : 0 rw : 0 rw : 0 rw : 0 bit name lsb first overrun spi complete tx reg empty rx reg full clock phase clock polarity enable bit name description
december 22, 2003 document no. 38-12009 rev. *d 99 cy8c22xxx preliminary data sheet 13. register details 13.1.14 dcbxxcr0 (uart transmitter control) digital communication type b block control register 0 for additional information, reference the ?register definitions? on page 198 in the digital blocks chapter. for the receive mode definition, refer to section 13.1.15 on page 100. [7:6] reserved [5] tx complete 0 indicates that a byte may still be in the process of shifting out. 1 indicates that a byte has been shifted out and all associated framing bits have been gener- ated. optional interrupt. cleared on read of this (cr0) register. [4] tx reg empty the reset state and the state when the block is disabled is ?1?. 0 indicates that a byte is currently buffered in the tx register. 1 indicates that a byte can be written to the tx register. cleared on write of the tx buffer reg- ister. default interrupt. tx reg empty interrupt will occur only after the first data byte is writ- ten and transferred into the shifter. [3] reserved [2] parity type 0 even parity 1 odd parity [1] parity enable 0 parity is not enabled. 1 parity is enabled, frame includes parity bit. [0] enable 0 serial transmitter is not enabled. 1 serial transmitter is enabled. individual register names and addresses dcb02cr0: 0,2bh dcb03cr0: 0,2fh 7 6 5 4 3 2 1 0 access : por r : 0 r : 1 rw : 0 rw : 0 rw : 0 bit name tx complete tx reg empty parity type parity enable enable bit name description
13. register details cy8c22xxx preliminary data sheet 100 document no. 38-12009 rev. *d december 22, 2003 13.1.15 dcbxxcr0 (uart receiver control) digital communication type b block control register 0 for additional information, reference the ?register definitions? on page 198 in the digital blocks chapter. for the transmit mode definition, refer to section 13.1.14 on page 99. [7] parity error 0 indicates that no parity error has occurred. 1 valid when rx reg full is set, indicating that a parity error has occurred in the received byte. cleared on read of this (cr0) register. [6] overrun 0 indicates that no overrun has occurred. 1 valid when rx reg full is set, indicating that the byte in the rx buffer register has not been read before the next byte is loaded. cleared on read of this (cr0) register. [5] framing error 0 indicates no framing error has occurred. 1 valid when rx reg full is set, indicating that a framing error has occurred (a logic ?0? was sampled at the stop bit, instead of the expected logic ?1?). cleared on read of this (cr0) register. [4] rx active 0 indicates that no reception is in progress. 1 indicates that a reception is in progress. set by the detection of a start bit and cleared at the sampling of the stop bit. [3] rx reg full 0 indicates that the rx buffer register is empty. 1 indicates that a byte has been received and transferred to the rx buffer (dr2) register. this bit is cleared when the rx buffer register (dr2) is read by the cpu. interrupt source. [2] parity type 0 even parity 1 odd parity [1] parity enable 0 parity is not enabled. 1 parity is enabled, frame includes parity bit. [0] enable 0 serial receiver is not enabled. 1 serial receiver is enabled. individual register names and addresses dcb02cr0: 0,2bh dcb03cr0: 0,2fh 7 6 5 4 3 2 1 0 access : por r : 0 r : 0 r : 0 r : 0 r : 0 rw : 0 rw : 0 rw : 0 bit name parity error overrun framing error rx active rx reg full parity type parity enable enable bit name description
december 22, 2003 document no. 38-12009 rev. *d 101 cy8c22xxx preliminary data sheet 13. register details 13.1.16 amx_in analog input select register for additional information, reference the ?register definitions? on page 235 in the analog input configuration chapter. [ 7:4] reserved [3:2] aci1[1:0] selects the analog column mux 1, even inputs. 00b acm1 p0[0] 01b acm1 p0[2] 10b acm1 p0[4] 11b acm1 p0[6] note acol1mux (abf_cr, address = bank1, 62h) 0 ac1 = acm1 1ac1 = acm0 [1:0] aci0[1:0] selects the analog column mux 1, odd inputs. 00b acm0 p0[1] 01b acm0 p0[3] 10b acm0 p0[5] 11b acm0 p0[7] individual register names and addresses amx_in: 0,60h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 bit name aci1[1:0] aci0[1:0] bit name description
13. register details cy8c22xxx preliminary data sheet 102 document no. 38-12009 rev. *d december 22, 2003 13.1.17 arf_cr analog reference control register for additional information, reference the ?register definitions? on page 238 in the analog reference chapter. [7] reserved [6] hbe bias level control for opamps 0 low bias mode for analog array 1 high bias mode for analog array [5:3] ref[2:0] analog array reference control (values with respect to vss). these three bits select the sources for analog ground (agnd), the high reference (refhigh), and the low reference (reflow). 000b invalid reference 001b invalid reference 010b valid reference: agnd = vdd/2, refhigh = vdd, reflow = vss. 011b invalid reference 100b invalid reference 101b invalid reference 110b invalid reference 111b invalid reference [2:0] pwr[2:0] analog array power control reference ct block sc blocks 000b off off off 001b low on off 010b medium on off 011b high on off 100b off off off 101b low on on 110b medium on on 111b high on on individual register names and addresses arf_cr: 0,63h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 bit name hbe ref[2:0] pwr[2:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 103 cy8c22xxx preliminary data sheet 13. register details 13.1.18 cmp_cr0 analog comparator bus 0 register for additional information, reference the ?register definitions? on page 228 in the analog interface chapter. [7:6] reserved [5] comp[1] comparator bus state for column 1. this bit is updated on the rising edge of phi2, unless the comparator latch disable bits are set. if the com- parator latch disable bits are set, then this bit is transparent to the comparator bus in the analog array. [4:2] reserved [1] aint[1] controls the selection of the analog comparator interrupt for column 1. 0 the comparator data bit from the column is the input to the interrupt controller. 1 the falling edge of phi2 for the column is the input to the interrupt controller. [0] reserved individual register names and addresses cmp_cr0: 0,64h 7 6 5 4 3 2 1 0 access : por r : 0 rw : 0 bit name comp[1] aint[1] bit name description
13. register details cy8c22xxx preliminary data sheet 104 document no. 38-12009 rev. *d december 22, 2003 13.1.19 asy_cr analog synchronization control register for additional information, reference the ?register definitions? on page 228 in the analog interface chapter. [7] reserved [6:4] sarcnt[2:0] initial sar count. this field is initialized to the number of sar bits to process. note any write to the sarcnt bits, other than 0, will result in a modification of the read back of any analog register in the analog array. these bits must always be zero, except for sar processing. [3] sarsign this bit adjusts the sar comparator based on the type of block addressed. in a dac configuration with more than one analog block (more than 6-bits), this bit should be set to ?0? when processing the most significant block, and ?1? when processing the least significant block. this is because the least significant block is an inverting input to the most significant block. [2] sarcol[1] the selected column corresponds with the position of the sar comparator block. note that the com- parator and dac can be in the same block. 00b analog column 0 is the source for sar comparator 01b analog column 1 is the source for sar comparator [1] reserved [0] syncen set to ?1?, will stall the cpu until the rising edge of phi1, if a write to a register within an analog switch cap block takes place. 0 cpu stalling disabled. 1 cpu stalling enabled. individual register names and addresses asy_cr: 0,65h 7 6 5 4 3 2 1 0 access : por w : 0 rw : 0 rw : 0 rw : 0 bit name sarcnt[2:0] sarsign sarcol[1] syncen bit name description
december 22, 2003 document no. 38-12009 rev. *d 105 cy8c22xxx preliminary data sheet 13. register details 13.1.20 cmp_cr1 analog comparator bus 1 register for additional information, reference the ?register definitions? on page 228 in the analog interface chapter. [7:6] reserved [5] cldis[1] controls the comparator output latch, column 1. 0 the comparator data bits are updated from the analog comparator bus, on the rising edge of phi2. 1 the comparator data bits are connected transparently to the analog comparator bus. this mode can be used in power down operation, to wake the part out of sleep as a result of an analog column interrupt. [4:0] reserved individual register names and addresses cmp_cr1: 0,66h 7 6 5 4 3 2 1 0 access : por rw : 0 bit name cldis[1] bit name description
13. register details cy8c22xxx preliminary data sheet 106 document no. 38-12009 rev. *d december 22, 2003 13.1.21 acbxxcr3 analog continuous time type b block control register 3 for additional information, reference the ?register definitions? on page 247 in the continuous time block chapter. [7:4] reserved [3] lpcmpen 0 low power comparator is disabled. 1 low power comparator is enabled. [2] cmout 0 no connection to column output 1 connect common mode to column output [1] insamp 0 normal mode 1 connect amplifiers across column to form an instrumentation amp [0] exgain 0 standard gain mode 1 high gain mode (see acbxxcr0) individual register names and addresses acb01cr3 : x,74h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 bit name lpcmpen cmout insamp exgain bit name description
december 22, 2003 document no. 38-12009 rev. *d 107 cy8c22xxx preliminary data sheet 13. register details 13.1.22 acbxxcr0 analog continuous time type b block control register 0 for additional information, reference the ?register definitions? on page 247 in the continuous time block chapter. [7:4] rtapmux[3:0] encoding for selecting one of 18 resistor taps. the four bits of rtapmux[3:0] allow selection of 16 taps. the two additional tap selections are provided using acbxxcr3 bit 0, exgain. the exgain bit only affects the rtapmux values 0h and 1h. rtap exgain rf ri loss gain 0h 1 47 1 0.0208 48.000 1h 1 46 2 0.0417 24.000 0h 0 45 3 0.0625 16.000 1h 0 42 6 0.1250 8.000 2h 0 39 9 0.1875 5.333 3h 0 36 12 0.2500 4.000 4h 0 33 15 0.3125 3.200 5h 0 30 18 0.3750 2.667 6h 0 27 21 0.4375 2.286 7h 0 24 24 0.5000 2.000 8h 0 21 27 0.5625 1.778 9h 0 18 30 0.6250 1.600 ah 0 15 33 0.6875 1.455 bh 0 12 36 0.7500 1.333 ch 0 9 39 0.8125 1.231 dh 0 6 42 0.8750 1.143 eh 0 3 45 0.9375 1.067 fh 0 0 48 1.0000 1.000 [3] gain select gain or loss configuration for output tap. 0 loss 1gain [2] rtopmux encoding for feedback resistor select. 0 rtop to vdd 1 rtop to opamp?s output [1:0] rbotmux[1:0] encoding for feedback resistor select. bits [1:0] are overridden if bit 1 of acbxxcr3 is set. in that case, the bottom of the resistor string is connected cross columns. note that available mux inputs vary by individual psoc block. acb01 00b reserved 01b agnd 10b vss 11b asd11 individual register names and addresses acb01cr0 : x,75h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 bit name rtapmux[3:0] gain rtopmux rbotmux[1:0] bit name description
13. register details cy8c22xxx preliminary data sheet 108 document no. 38-12009 rev. *d december 22, 2003 13.1.23 acbxxcr1 analog continuous time type b block control register 1 for additional information, reference the ?register definitions? on page 247 in the continuous time block chapter. [7] analogbus enable output to the analog bus. 0 disable output to analog column bus. 1 enable output to analog column bus. [6] compbus enable output to the comparator bus. 0 disable output to comparator bus. 1 enable output to comparator bus. [5:3] nmux[2:0] encoding for negative input select. note that available mux inputs vary by individual psoc block. acb01 000b reserved 001b agnd 010b vss 011b vdd 100b fb # 101b asd11 110b reserved 111b port inputs # feedback point from tap of the feedback resistor as defined by corresponding cr0 bits [7:4] and cr3 bit 0. [2:0] pmux[2:0] encoding for positive input select. note that available mux inputs vary by individual psoc block. acb01 000b vss 001b port inputs 010b reserved 011b agnd 100b asd11 101b reserved 110b abus1 111b fb # # feedback point from tap of the feedback resistor as defined by corresponding cr0 bits [7:4] and cr3 bit 0. individual register names and addresses acb01cr1 : x,76h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 bit name analogbus compbus nmux[2:0] pmux[2:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 109 cy8c22xxx preliminary data sheet 13. register details 13.1.24 acbxxcr2 analog continuous time type b block control register 2 for additional information, reference the ?register definitions? on page 247 in the continuous time block chapter. [7] cphase 0 comparator control latch transparent on phi1. 1 comparator control latch transparent on phi2. [6] clatch 0 comparator control latch is always transparent. 1 comparator control latch is active. [5] compcap 0comparator mode 1 opamp mode [4] tmuxen test mux 0 disabled 1 enabled [3:2] testmux[1:0] select block bypass mode. note that available mux inputs vary by individual psoc block and tmuxen must be set. acb01 00b positive input to abus1 01b agnd to abus1 10b reflo to abus1 11b refhi to abus1 [1:0] pwr[1:0] encoding for selecting one of four power levels. high bias mode doubles the power at each of these settings. see bit 6 in the arf_cr register on page 102 . 00b off 01b low 10b medium 11b high individual register names and addresses acb01cr2 : x,77h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 bit name cphase clatch compcap tmuxen testmux[1:0] pwr[1:0] bit name description
13. register details cy8c22xxx preliminary data sheet 110 document no. 38-12009 rev. *d december 22, 2003 13.1.25 ascxxcr0 analog switch cap type c block control register 0 for additional information, reference the ?register definitions? on page 241 in the switched capacitor block chapter. [7] fcap f capacitor value selection bit. 0 16 capacitor units 1 32 capacitor units [6] clockphase the clockphase controls the clock phase of the comparator within the switched cap blocks, as well as the clock phase of the switches. 0 switch phasing is internal phi1 = external phi1. comparator capture point event is trig- gered by falling phi2 and comparator output point event is triggered by rising phi1. 1 switch phasing is internal phi1 = external phi2. comparator capture point event is trig- gered by falling phi1 and comparator output point event is triggered by rising phi2. [5] asign 0 input sampled on internal phi1. reference input sampled on internal phi2. positive gain. 1 input sampled on internal phi2. reference input sampled on internal phi1. negative gain. [4:0] acap[4:0] binary encoding for 32 possible capacitor sizes for capacitor acap. individual register names and addresses asc21cr0 : x,94h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 00 bit name fcap clockphase asign acap[4:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 111 cy8c22xxx preliminary data sheet 13. register details 13.1.26 ascxxcr1 analog switch cap type c block control register 1 for additional information, reference the ?register definitions? on page 241 in the switched capacitor block chapter. [7:5] acmux[2:0] encoding for selecting a and c inputs. (note that available mux inputs vary by individual psoc block.) asc21 a inputs c inputs 000b asd11 asd11 001b reserved reserved 010b vdd asd11 011b vtemp asd11 100b reserved reserved 101b reserved reserved 110b abus1 asd11 111b reserved reserved [4:0] bcap[4:0] binary encoding for 32 possible capacitor sizes of the capacitor bcap. individual register names and addresses asc21cr1 : x,95h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 00 bit name acmux[2:0] bcap[4:0] bit name description
13. register details cy8c22xxx preliminary data sheet 112 document no. 38-12009 rev. *d december 22, 2003 13.1.27 ascxxcr2 analog switch cap type c block control register 2 for additional information, reference the ?register definitions? on page 241 in the switched capacitor block chapter. [7 ] analogbus enable output to the analog bus. 0 disable output to analog column bus. 1 enable output to analog column bus. [6] compbus enable output to the comparator bus. 0 disable output to comparator bus. 1 enable output to comparator bus. [5] autozero bit for controlling gated switches. 0 shorting switch is not active. input cap branches shorted to opamp input. 1 shorting switch is enabled during internal phi1. input cap branches shorted to analog ground during internal phi1 and to opamp input during internal phi2. [4:0] ccap[4:0] binary encoding for 32 possible capacitor sizes of the capacitor ccap. individual register names and addresses asc21cr2 : x,96h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 00 bit name analogbus compbus autozero ccap[4:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 113 cy8c22xxx preliminary data sheet 13. register details 13.1.28 ascxxcr3 analog switch cap type c block control register 3 for additional information, reference the ?register definitions? on page 241 in the switched capacitor block chapter. [7:6] arefmux[1:0] encoding for selecting reference input. 00b analog ground is selected. 01b refhi input selected. (this is usually the high reference.) 10b reflo input selected. (this is usually the low reference.) 11b reference selection is driven by the comparator. (when output comparator node is set high, the input is set to refhi. when set low, the input is set to reflo.) [5] fsw1 bit for controlling gated switches. 0 switch is disabled. 1 if the fsw1 bit is set to ?1?, the state of the switch is determined by the autozero bit. if the autozero bit is ?0?, the switch is enabled at all times. if the autozero bit is ?1?, the switch is enabled only when the internal phi2 is high. [4] fsw0 bits for controlling gated switches. 0 switch is disabled. 1 switch is enabled when phi1 is high. [3:2] bmuxsc[1:0] encoding for selecting b inputs. note that the available mux inputs vary by individual psoc block. asc21 00b asd11 01b reserved 10b reserved 11b trefgnd [1:0] pwr[1:0] encoding for selecting one of four power levels. 00b off 01b low 10b medium 11b high individual register names and addresses asc21cr3 : x,97h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 bit name arefmux[1:0] fsw1 fsw0 bmuxsc[1:0] pwr[1:0] bit name description
13. register details cy8c22xxx preliminary data sheet 114 document no. 38-12009 rev. *d december 22, 2003 13.1.29 asdxxcr0 analog switch cap type d block control register 0 for additional information, reference the ?register definitions? on page 241 in the switched capacitor block chapter. [7] fcap f capacitor value selection bit. 0 16 capacitor units 1 32 capacitor units [6] clockphase the clockphase controls the clock phase of the comparator within the switched cap blocks, as well as the clock phase of the switches. 0 switch phasing is internal phi1 = external phi1. comparator capture point event is trig- gered by falling phi2 and comparator output point event is triggered by rising phi1. 1 switch phasing is internal phi1 = external phi2. comparator capture point event is trig- gered by falling phi1 and comparator output point event is triggered by rising phi2. [5] asign 0 input sampled on internal phi1. reference input sampled on internal phi2. positive gain. 1 input sampled on internal phi2. reference input sampled on internal phi1. negative gain. [4:0] acap[4:0] binary encoding for 32 possible capacitor sizes for capacitor acap. individual register names and addresses asd11cr0 : x,84h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 00 bit name fcap clockphase asign acap[4:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 115 cy8c22xxx preliminary data sheet 13. register details 13.1.30 asdxxcr1 analog switch cap type d block control register 1 for additional information, reference the ?register definitions? on page 241 in the switched capacitor block chapter. [7:5] amux[2:0] encoding for selecting a and c inputs for c type blocks and a inputs for d type blocks. (note that available mux inputs vary by individual psoc block.) asd11 000b acb01 001b reserved 010b reserved 011b asc21 100b vdd 101b reserved 110b reserved 111b reserved [4:0] bcap[4:0] binary encoding for 32 possible capacitor sizes for capacitor bcap. individual register names and addresses asd11cr1 : x,85h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 00 bit name amux[2:0] bcap[4:0] bit name description
13. register details cy8c22xxx preliminary data sheet 116 document no. 38-12009 rev. *d december 22, 2003 13.1.31 asdxxcr2 analog switch cap type d block control register 2 for additional information, reference the ?register definitions? on page 241 in the switched capacitor block chapter. [7] analogbus enable output to the analog bus. 0 disable output to analog column bus. 1 enable output to analog column bus. [6] compbus enable output to the comparator bus. 0 disable output to comparator bus. 1 enable output to comparator bus. [5 ] autozero bit for controlling gated switches. 0 shorting switch is not active. input cap branches shorted to opamp input. 1 shorting switch is enabled during internal phi1. input cap branches shorted to analog ground during internal phi1 and to opamp input during internal phi2. [4:0] ccap[4:0] binary encoding for 32 possible capacitor sizes for capacitor ccap. individual register names and addresses asd11cr2 : x,86h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 00 bit name analogbus compbus autozero ccap[4:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 117 cy8c22xxx preliminary data sheet 13. register details 13.1.32 asdxxcr3 analog switch cap type d block control register 3 for additional information, reference the ?register definitions? on page 241 in the switched capacitor block chapter. [7:6] arefmux[1:0] encoding for selecting reference input. 00b analog ground is selected. 01b refhi input selected. (this is usually the high reference.) 10b reflo input selected. (this is usually the low reference.) 11b reference selection is driven by the comparator. (when output comparator node is set high, the input is set to refhi. when set low, the input is set to reflo.) [5] fsw1 bit for controlling gated switches. 0 switch is disabled. 1 if the fsw1 bit is set to ?1?, the state of the switch is determined by the autozero bit. if the autozero bit is ?0?, the switch is enabled at all times. if the autozero bit is ?1?, the switch is enabled only when the internal phi2 is high. [4] fsw0 bits for controlling gated switches. 0 switch is disabled. 1 switch is enabled when phi1 is high. [3] bsw enable switching in branch. 0 b branch is a continuous time path. 1 b branch is switched with internal phi2 sampling. [2] bmuxsd encoding for selecting b inputs. (note that the available mux inputs vary by individual psoc block.) asd11 0 reserved 1acb01 [1:0] pwr[1:0] encoding for selecting one of four power levels. 00b off 01b 10 a, typical 10b 50 a, typical 11b 200 a, typical individual register names and addresses asd11cr3 : x,87h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 bit name arefmux[1:0] fsw1 fsw0 bsw bmuxsd pwr[1:0] bit name description
13. register details cy8c22xxx preliminary data sheet 118 document no. 38-12009 rev. *d december 22, 2003 13.1.33 rdixri row digital interconnect row input register for additional information, reference the ?register definitions? on page 186 in the row digital interconnect chapter. [7:6] ri3[2:0] select source for row input 3. 00b gie[3] 01b gie[7] 10b gio[3] 11b gio[7] [5:4] ri2[2:0] select source for row input 2. 00b gie[2] 01b gie[6] 10b gio[2] 11b gio[6] [3:2] ri1[2:0] select source for row input 1. 00b gie[1] 01b gie[5] 10b gio[1] 11b gio[5] [1:0] ri0[2:0] select source for row input 0. 00b gie[0] 01b gie[4] 10b gio[0] 11b gio[4] individual register names and addresses rdi0ri : x,b0h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 bit name ri3[2:0] ri2[2:0] ri1[2:0] ri0[2:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 119 cy8c22xxx preliminary data sheet 13. register details 13.1.34 rdixsyn row digital interconnect synchronization register for additional information, reference the ?register definitions? on page 186 in the row digital interconnect chapter. [7:4] reserved [3] ri3syn 0 row input 3 is synchronized to sysclk system clock. 1 row input 3 is passed without synchronization. [2] ri2syn 0 row input 2 is synchronized to sysclk system clock. 1 row input 2 is passed without synchronization. [1] ri1syn 0 row input 1 is synchronized to sysclk system clock. 1 row input 1 is passed without synchronization. [0] ri0syn 0 row input 0 is synchronized to sysclk system clock. 1 row input 0 is passed without synchronization. individual register names and addresses rdi0syn : x,b1h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 bit name ri3syn ri2syn ri1syn ri0syn bit name description
13. register details cy8c22xxx preliminary data sheet 120 document no. 38-12009 rev. *d december 22, 2003 13.1.35 rdixis row digital interconnect input select register for additional information, reference the ?register definitions? on page 186 in the row digital interconnect chapter . [7:6] reserved [5:4] bcsel[1:0] when the bcsell value is equal to the row number, the tri-state buffer that drives the row broadcast net from the input select mux is disabled, so that one of the row?s blocks may drive the local row broadcast net. 00b row 0 drives row broadcast net. 01b reserved 10b reserved 11b reserved [3] is3 0 the ?a? input of lut 3 is ro[3]. 1 the ?a? input of lut 3 is ri[3]. [2] is2 0 the ?a? input of lut 2 is ro[2]. 1 the ?a? input of lut 2 is ri[2]. [1] is1 0 the ?a? input of lut 1 is ro[1]. 1 the ?a? input of lut 1 is ri[1]. [0] is0 0 the ?a? input of lut 0 is ro[0]. 1 the ?a? input of lut 0 is ri[0]. individual register names and addresses rdi0is : x,b2h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 bit name bcsel[1:0] is3 is2 is1 is0 bit name description
december 22, 2003 document no. 38-12009 rev. *d 121 cy8c22xxx preliminary data sheet 13. register details 13.1.36 rdixlt0 row digital interconnect logic table register 0 for additional information, reference the ?register definitions? on page 186 in the row digital interconnect chapter . [7:4] lut1[3:0 ] select logic function for lut 1. function 0h false 1h a and b 2h a and b 3h a 4h a and b 5h b 6h a xor b 7h a or b 8h a nor b 9h a xnor b ah b bh a or b ch a dh a or b eh a nand b fh true [3:0] lut0[3:0] select logic function for lut 0. function 0h false 1h a and b 2h a and b 3h a 4h a and b 5h b 6h a xor b 7h a or b 8h a nor b 9h a xnor b ah b bh a or b ch a dh a or b eh a nand b fh true individual register names and addresses rdi0lt0 : x,b3h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 bit name lut1[3:0] lut0[3:0] bit name description
13. register details cy8c22xxx preliminary data sheet 122 document no. 38-12009 rev. *d december 22, 2003 13.1.37 rdixlt1 row digital interconnect logic table register 1 for additional information, reference the ?register definitions? on page 186 in the row digital interconnect chapter . [7:4] lut3[3:0] select logic function for lut 3. function 0h false 1h a and b 2h a and b 3h a 4h a and b 5h b 6h a xor b 7h a or b 8h a nor b 9h a xnor b ah b bh a or b ch a dh a or b eh a nand b fh true [3:0] lut2[3:0] select logic function for lut 2. function 0h false 1h a and b 2h a and b 3h a 4h a and b 5h b 6h a xor b 7h a or b 8h a nor b 9h a xnor b ah b bh a or b ch a dh a or b eh a nand b fh true individual register names and addresses rdi0lt1 : x,b4h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 bit name lut3[3:0] lut2[3:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 123 cy8c22xxx preliminary data sheet 13. register details 13.1.38 rdixro0 row digital interconnect row output register 0 for additional information, reference the ?register definitions? on page 186 in the row digital interconnect chapter . [7] goo5en 0 disable lut output to global output. 1 enable lut output to goo[5]. [6] goo1en 0 disable lut output to global output. 1 enable lut output to goo[1]. [5] goe5en 0 disable lut output to global output. 1 enable lut output to goe[5]. [4] goe1en 0 disable lut output to global output. 1 enable lut output to goe[1]. [3] goo4en 0 disable lut output to global output. 1 enable lut output to goo[4]. [2] goo0en 0 disable lut output to global output. 1 enable lut output to goo[0]. [1] goe4en 0 disable lut output to global output. 1 enable lut output to goe[4]. [0] goe0en 0 disable lut output to global output. 1 enable lut output to goe[0]. individual register names and addresses rdi0ro0 : x,b5h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 bit name goo5en goo1en goe5en goe1en goo4en goo0en goe4en goe0en bit name description
13. register details cy8c22xxx preliminary data sheet 124 document no. 38-12009 rev. *d december 22, 2003 13.1.39 rdixro1 row digital interconnect row output register 1 for additional information, reference the ?register definitions? on page 186 in the row digital interconnect chapter . [7] goo7en 0 disable lut output to global output. 1 enable lut output to goo[7]. [6] goo3en 0 disable lut output to global output. 1 enable lut output to goo[3]. [5] goe7en 0 disable lut output to global output. 1 enable lut output to goe[7]. [4] goe3en 0 disable lut output to global output. 1 enable lut output to goe[3]. [3] goo6en 0 disable lut output to global output. 1 enable lut output to goo[6]. [2] goo2en 0 disable lut output to global output. 1 enable lut output to goo[2]. [1] goe6en 0 disable lut output to global output. 1 enable lut output to goe[6]. [0] goe2en 0 disable lut output to global output. 1 enable lut output to goe[2]. individual register names and addresses rdi0ro1 : x,b6h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 bit name goo7en goo3en goe7en goe3en goo6en goo2en goe6en goe2en bit name description
december 22, 2003 document no. 38-12009 rev. *d 125 cy8c22xxx preliminary data sheet 13. register details 13.1.40 i2c_cfg i2c configuration register for additional information, reference the ?register definitions? on page 265 in the i 2 c chapter . [7] reserved [6] pselect i 2 c pin select 0 p1[5] and p1[7] 1 p1[0] and p1[1] note read the i 2 c chapter for a discussion of the side effects of choosing this pair of pins: p1[0] and p1[1]. [5] bus error ie bus error interrupt enable 0 disabled 1 enabled. an interrupt is generated on the detection of a bus error. [4] stop ie stop interrupt enable 0 disabled 1 enabled. an interrupt is generated on the detection of a stop condition. [3:2] clock rate 00b 100k standard mode 01b 400k fast mode 10b 50k standard mode 11b reserved [1] enable master 0 disabled 1 enabled [0] enable slave 0 disabled 1 enabled individual register names and addresses i2c_cfg: 0,d6h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 bit name pselect bus error ie stop ie clock rate enable master enable slave bit name description
13. register details cy8c22xxx preliminary data sheet 126 document no. 38-12009 rev. *d december 22, 2003 13.1.41 i2c_scr i2c status and control register bits in this register are held in reset until one of the enable bits in i2c_cfg is set. for additional information, reference t he ?register definitions? on page 265 in the i 2 c chapter . [7] bus error 0 this status bit must be cleared by firmware by writing a ?0? to the bit position. it is never cleared by the hardware. 1 a misplaced start or stop condition was detected. [6] lost arb 0 this bit is set immediately on lost arbitration; however, it does not cause an interrupt. this status may be checked after the following byte complete interrupt. any start detect or a write to the start or restart generate bits (i2c_mscr register), when operating in master mode, will also clear the bit. 1lost arbitration [5] stop status 0 this status bit must be cleared by firmware with write of ?0? to the bit position. it is never cleared by the hardware. 1 a stop condition was detected. [4] ack acknowledge out. this bit is automatically cleared by hardware on a byte complete event. 0 nack the last received byte. 1 ack the last received byte [3] address 0 this status bit must be cleared by firmware with write of ?0? to the bit position. 1 the received byte is a slave address. [2] transmit this bit is set by firmware to define the direction of the byte transfer. any start detect or a write to the start or restart generate bits, when operating in master mode, will also clear the bit. 0 receive mode 1 transmit mode [1] lrb last received bit. the value of the 9 th bit in a transmit sequence, which is the acknowledge bit from the receiver. any start detect or a write to the start or restart generate bits, when operating in master mode, will also clear the bit. 0 last transmitted byte was acked by the receiver. 1 last transmitted byte was nacked by the receiver. [0] byte complete transmit/receive mode: 0 no completed transmit/receive since last cleared by firmware. any start detect or a write to the start or restart generate bits, when operating in master mode, will also clear the bit. transmit mode: 1 eight bits of data have been transmitted and an ack or nack has been received. receive mode: 1 eight bits of data have been received. individual register names and addresses i2c_scr: 0,d7h 7 6 5 4 3 2 1 0 access : por rc : 0 rc : 0 rc : 0 rw : 0 rc : 0 rw : 0 rc : 0 rc : 0 bit name bus error lost arb stop status ack address transmit lrb byte complete bit name description
december 22, 2003 document no. 38-12009 rev. *d 127 cy8c22xxx preliminary data sheet 13. register details 13.1.42 i2c_dr i2c data register this register is read only for received data and write only for transmitted data. for additional information, reference the ?reg- ister definitions? on page 265 in the i 2 c chapter . [7:0] data read received data or write data to transmit. individual register names and addresses i2c_dr: 0,d8h 7 6 5 4 3 2 1 0 access : por rw : 00 bit name data[7:0] bit name description
13. register details cy8c22xxx preliminary data sheet 128 document no. 38-12009 rev. *d december 22, 2003 13.1.43 i2c_mscr i2c master status and control register bits in this register are held in reset until one of the enable bits in i2c_cfg is set. for additional information, reference the ?register definitions? on page 265 in the i 2 c chapter . [7:4] reserved [3] bus busy this bit is set to: 0 when a stop condition is detected (from any bus master). 1 when a start condition is detected (from any bus master). [2] master mode this bit is set/cleared by hardware when the device is operating as a master. 0 stop condition detected, generated by this device. 1 start condition detected, generated by this device. [1] restart gen this bit is cleared by hardware when the restart generation is complete. 0 restart generation complete. 1 generate a restart condition. [0] start gen this bit is cleared by hardware when the start generation is complete. 0 start generation complete. 1 generate a start condition and send a byte (address) to the i2c bus, if bus is not busy. individual register names and addresses i2c_mscr: 0,d9h 7 6 5 4 3 2 1 0 access : por r : 0 r : 0 rw : 0 rw : 0 bit name bus busy master mode restart gen start gen bit name description
december 22, 2003 document no. 38-12009 rev. *d 129 cy8c22xxx preliminary data sheet 13. register details 13.1.44 int_clr0 interrupt clear register 0 when bits in this register are read, a ?1? will be returned for every bit position that has a corresponding posted interrupt. w hen bits in this register are written with a zero (0) and enswint is not set, posted interrupts will be cleared at the correspondin g bit positions. if there was not a posted interrupt, there is no effect. when bits in this register are written with a one (1) a nd enswint is set, an interrupt is posted in the interrupt controller. note that the enswint bit is in the int_msk3 register on page 133 . for additional information, reference the ?register definitions? on page 53 in the interrupt controller chapter. [7] vc3 read 0 no posted interrupt for variable clock 3. read 1 posted interrupt present for variable clock 3. write 0 and enswint = 0 clear posted interrupt if it exists. write 1 and enswint = 0 no effect. write 0 and enswint = 1 no effect. write 1 and enswint = 1 post an interrupt for variable clock 3. [6] sleep read 0 no posted interrupt for sleep timer. read 1 posted interrupt present for sleep timer. write 0 and enswint = 0 clear posted interrupt if it exists. write 1 and enswint = 0 no effect. write 0 and enswint = 1 no effect. write 1 and enswint = 1 post an interrupt for sleep timer. [5] gpio read 0 no posted interrupt for general purpose inputs and outputs (pins). read 1 posted interrupt present for gpio (pins). write 0 and enswint = 0 clear posted interrupt if it exists. write 1 and enswint = 0 no effect. write 0 and enswint = 1 no effect. write 1 and enswint = 1 post an interrupt for general purpose inputs and outputs (pins). [4:3] reserved [2] analog 1 read 0 no posted interrupt for analog columns. read 1 posted interrupt present for analog columns write 0 and enswint = 0 clear posted interrupt if it exists. write 1 and enswint = 0 no effect. write 0 and enswint = 1 no effect. write 1 and enswint = 1 post an interrupt for analog columns. [1] reserved (continued on next page) individual register names and addresses int_clr0: 0,dah 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 bit name vc3 sleep gpio analog 1 v monitor bit name description
13. register details cy8c22xxx preliminary data sheet 130 document no. 38-12009 rev. *d december 22, 2003 13.1.44 int_clr0 (continued) [0] v monitor read 0 no posted interrupt for supply voltage monitor. read 1 posted interrupt present for supply voltage monitor. write 0 and enswint = 0 clear posted interrupt if it exists. write 1 and enswint = 0 no effect. write 0 and enswint = 1 no effect. write 1 and enswint = 1 post an interrupt for supply voltage monitor.
december 22, 2003 document no. 38-12009 rev. *d 131 cy8c22xxx preliminary data sheet 13. register details 13.1.45 int_clr1 interrupt clear register 1 when bits in this register are read, a ?1? will be returned for every bit position that has a corresponding posted interrupt. w hen bits in this register are written with a zero (0) and enswint is not set, posted interrupts will be cleared at the correspondin g bit positions. if there was not a posted interrupt, there is no effect. when bits in this register are written with a one (1) a nd enswint is set, an interrupt is posted in the interrupt controller. note that the enswint bit is in the int_msk3 register on page 133 . for additional information, reference the ?register definitions? on page 53 in the interrupt controller chapter. [7:4] reserved [3] dcb03 digital communications block type b, row 0, position 3. read 0 no posted interrupt. read 1 posted interrupt present. write 0 and enswint = 0 clear posted interrupt if it exists. write 1 and enswint = 0 no effect. write 0 and enswint = 1 no effect. write 1 and enswint = 1 post an interrupt. [2] dcb02 digital communications block type b, row 0, position 2. read 0 no posted interrupt. read 1 posted interrupt present. write 0 and enswint = 0 clear posted interrupt if it exists. write 1 and enswint = 0 no effect. write 0 and enswint = 1 no effect. write 1 and enswint = 1 post an interrupt. [1] dbb01 digital basic block type b, row 0, position 1. read 0 no posted interrupt. read 1 posted interrupt present. write 0 and enswint = 0 clear posted interrupt if it exists. write 1 and enswint = 0 no effect. write 0 and enswint = 1 no effect. write 1 and enswint = 1 post an interrupt. [0] dbb00 digital basic block type b, row 0, position 0. read 0 no posted interrupt. read 1 posted interrupt present. write 0 and enswint = 0 clear posted interrupt if it exists. write 1 and enswint = 0 no effect. write 0 and enswint = 1 no effect. write 1 and enswint = 1 post an interrupt. individual register names and addresses int_clr1: 0,dbh 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 00 rw : 0 bit name dcb03 dcb02 dbb01 dbb00 bit name description
13. register details cy8c22xxx preliminary data sheet 132 document no. 38-12009 rev. *d december 22, 2003 13.1.46 int_clr3 interrupt clear register 3 when bits in this register are read, a ?1? will be returned for every bit position that has a corresponding posted interrupt. w hen bits in this register are written with a zero (0) and enswint is cleared, any posted interrupt will be cleared. if there was no t a posted interrupt, there is no effect. when bits in this register are written with a one (1) and enswint is set, an interrupt is posted in the interrupt controller. for additional information, reference the ?register definitions? on page 53 in the interrupt controller chapter. [7:1] reserved [0] i2c read 0 no posted interrupt for i2c. read 1 posted interrupt present for i2c. write 0 and enswint = 0 clear posted interrupt if it exists. write 1 and enswint = 0 no effect. write 0 and enswint = 1 no effect. write 1 and enswint = 1 post an interrupt for i2c. individual register names and addresses int_clr3: 0,ddh 7 6 5 4 3 2 1 0 access : por rw : 0 bit name i2c bit name description
december 22, 2003 document no. 38-12009 rev. *d 133 cy8c22xxx preliminary data sheet 13. register details 13.1.47 int_msk3 interrupt mask register 3 note that when an interrupt is masked off, the mask bit is ?0?. the interrupt will still post in the interrupt controller. ther efore, clearing the mask bit only prevents a posted interrupt from becoming a pending interrupt. for additional information, refer- ence the ?register definitions? on page 53 in the interrupt controller chapter. [7] enswint 0 disable software interrupts. 1 enable software interrupts. [6:1] reserved [0] i2c 0 mask i2c interrupt 1 unmask i2c interrupt individual register names and addresses int_msk3: 0,deh 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 bit name enswint i2c bit name description
13. register details cy8c22xxx preliminary data sheet 134 document no. 38-12009 rev. *d december 22, 2003 13.1.48 int_msk0 interrupt mask register 0 note that when an interrupt is masked off, the mask bit is ?0?. the interrupt will still post in the interrupt controller. ther efore, clearing the mask bit only prevents a posted interrupt from becoming a pending interrupt. for additional information, refer- ence the ?register definitions? on page 53 in the interrupt controller chapter. [7] vc3 0 mask vc3 interrupt. 1 unmask vc3 interrupt. [6] sleep 0 mask sleep interrupt. 1 unmask sleep interrupt. [5] gpio 0 mask gpio interrupt. 1 unmask gpio interrupt. [4:3] reserved [2] analog 1 0 mask analog interrupt, column 1. 1 unmask analog interrupt. [1] reserved [0] v monitor 0 mask voltage monitor interrupt. 1 unmask voltage monitor interrupt. individual register names and addresses int_msk0: 0,e0h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 bit name vc3 sleep gpio analog 1 v monitor bit name description
december 22, 2003 document no. 38-12009 rev. *d 135 cy8c22xxx preliminary data sheet 13. register details 13.1.49 int_msk1 interrupt mask register 1 note that when an interrupt is masked off, the mask bit is ?0?. the interrupt will still post in the interrupt controller. ther efore, clearing the mask bit only prevents a posted interrupt from becoming a pending interrupt. for additional information, refer- ence the ?register definitions? on page 53 in the interrupt controller chapter. [7:4] reserved [3] dcb03 0 mask digital communication block, row 0, position 3 off. 1 unmask digital communication block, row 0, position 3. [2] dcb02 0 mask digital communication block, row 0, position 2 off. 1 unmask digital communication block, row 0, position 2. [1] dbb01 0 mask digital basic block, row 0, position 1 off. 1 unmask digital basic block, row 0, position 1. [0] dbb00 0 mask digital basic block, row 0, position 0 off. 1 unmask digital basic block, row 0, position 0. individual register names and addresses int_msk1: 0,e1h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 bit name dcb03 dcb02 dbb01 dbb00 bit name description
13. register details cy8c22xxx preliminary data sheet 136 document no. 38-12009 rev. *d december 22, 2003 13.1.50 int_vc interrupt vector clear register for additional information, reference the ?register definitions? on page 53 in the interrupt controller chapter. [7:0] pending interrupt[7:0] read returns vector for highest priority pending interrupt. write clears all pending and posted interrupts. individual register names and addresses int_vc: 0,e2h 7 6 5 4 3 2 1 0 access : por rc : 00 bit name pending interrupt[7:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 137 cy8c22xxx preliminary data sheet 13. register details 13.1.51 res_wdt reset watchdog timer register for additional information, reference the ?register definitions? on page 75 in the sleep and watchdog chapter. [7:0] wdsl_clear[7:0] any write clears the watchdog timer. a write of 38h clears both the watchdog and sleep timers. individual register names and addresses res_wdt: 0,e3h 7 6 5 4 3 2 1 0 access : por w : 00 bit name wdsl_clear[7:0] bit name description
13. register details cy8c22xxx preliminary data sheet 138 document no. 38-12009 rev. *d december 22, 2003 13.1.52 dec_dh decimator data high register when a hardware reset occurs, the internal state of the decimator is reset, but the output data registers (dec_dh and dec_dl) are not. for additional information, reference the ?register definitions? on page 259 in the decimator chapter. [7:0] data high byte[7:0] read returns the high byte of the decimator. write clears the 16-bit accumulator values. either the dec_dh or dec_dl register may be writ- ten to clear the accumulators (i.e., it is not necessary to write both). individual register names and addresses dec_dh: 0,e4h 7 6 5 4 3 2 1 0 access : por rc : xx bit name data high byte[7:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 139 cy8c22xxx preliminary data sheet 13. register details 13.1.53 dec_dl decimator data low register when a hardware reset occurs, the internal state of the decimator is reset, but the output data registers (dec_dh and dec_dl) are not. for additional information, reference the ?register definitions? on page 259 in the decimator chapter. [7:0] data low byte[7:0] read returns the high byte of the decimator. write clears the 16-bit accumulator values. either the dec_dh or dec_dl register may be writ- ten to clear the accumulators (i.e., it is not necessary to write both). individual register names and addresses dec_dl: 0,e5h 7 6 5 4 3 2 1 0 access : por rc : xx bit name data low byte[7:0] bit name description
13. register details cy8c22xxx preliminary data sheet 140 document no. 38-12009 rev. *d december 22, 2003 13.1.54 dec_cr0 decimator control register 0 for additional information, reference the ?register definitions? on page 259 in the decimator chapter. [7:4] igen[3:0] incremental gate enable. selects on a column basis which comparator outputs will be gated with the incremental gating function. 1h reserved 2h analog column 1 4h reserved 8h reserved [3] iclks0 incremental gate source. along with iclks1 in dec_cr1, selects one of the possible digital blocks, depending on your chip resources, to control the incremental gating function. iclks1 (see the dec_cr1 register), iclks0 000b digital block 02 010b digital block 01 [2:1] dcol[1:0] decimator column source. selects the analog comparator column as a data source for the decima- tor. 00b reserved 01b analog column 1 10b reserved 11b reserved [0] dclks0 decimator latch select. along with dclks1 in dec_cr1, selects one of the possible digital blocks, depending on your chip resources, to control the decimator output latch. dclks1 (see the dec_cr1 register), dclks0 000b digital block 02 010b digital block 01 individual register names and addresses dec_cr0: 0,e6h 7 6 5 4 3 2 1 0 access : por rw : 00 rw : 0 rw : 0 rw : 0 bit name igen[3:0] iclks0 dcol[1:0] dclks0 bit name description
december 22, 2003 document no. 38-12009 rev. *d 141 cy8c22xxx preliminary data sheet 13. register details 13.1.55 dec_cr1 decimator control register 1 for additional information, reference the ?register definitions? on page 259 in the decimator chapter. [7] ecnt 0 disable decimator as a counter for incremental adc. configure for delta sigma operation. 1 enable decimator as a counter for incremental adc operation. [6] idec invert the digital block latch control (selected by {dclks[1:0], dclks0}). 0 non-inverted 1inverted [5:4] reserved [3] iclks1 incremental gate source. along with iclks0 in dec_cr0, selects one of the possible digital blocks, depending on your chip resources, to control the incremental gating function. iclks1, iclks0 (see the dec_cr0 register) 000b digital block 02 010b digital block 01 [2:1] reserved [0] dclks1 decimator latch select. along with dclks0 in dec_cr0, selects one of the possible digital blocks, depending on your chip resources, to control the decimator output latch. dclks1, dclks0 (see the dec_cr0 register) 000b digital block 02 010b digital block 01 individual register names and addresses dec_cr1: 0,e7h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 bit name ecnt idec iclks1 dclks1 bit name description
13. register details cy8c22xxx preliminary data sheet 142 document no. 38-12009 rev. *d december 22, 2003 13.1.56 cpu_f m8c flags register the and, or, and xor flag instructions can be used to modify this register. for additional information, reference the ?regis- ter definitions? on page 43 in the m8c chapter and the ?register definitions? on page 53 in the interrupt controller chapter. [7:5] reserved [4] xoi 0 normal register address space 1 extended register address space. primarily used for configuration. [3] reserved [2] carry set by the m8c cpu core to indicate whether there has been a carry in the previous logical/arith- metic operation. 0 no carry 1 carry [1] zero set by the m8c cpu core to indicate whether there has been a zero result in the previous logical/ arithmetic operation. 0 not equal to zero 1 equal to zero [0] gie 0 m8c will not process any interrupts. 1 interrupt processing enabled. individual register names and addresses cpu_f: x,f7h 7 6 5 4 3 2 1 0 access : por rl : 0 rl : 0 rl : 0 rl : 0 bit name xoi carry zero gie bit name description
december 22, 2003 document no. 38-12009 rev. *d 143 cy8c22xxx preliminary data sheet 13. register details 13.1.57 cpu_scr1 system status and control register 1 for additional information, reference the ?register definitions? on page 49 in the srom chapter or ?register definitions? on page 68 of the 32 khz crystal oscillator chapter. [7:1] reserved [0] iramdis 0 sram is initialized to 00h after por, xres, and wdr. 1 address 03h - d7h are not modified by wdr. individual register names and addresses cpu_scr1: x,feh 7 6 5 4 3 2 1 0 access : por rw : 0 bit name iramdis bit name description
13. register details cy8c22xxx preliminary data sheet 144 document no. 38-12009 rev. *d december 22, 2003 13.1.58 cpu_scr0 system status and control register 0 for additional information, reference the ?register definitions? on page 75 in the sleep and watchdog chapter. [7] gies global interrupt enable status. it is recommended that the user read the global interrupt enable flag bit from the cpu_f register on page 142 . this bit is read only for gies. its use is discouraged, as the flag register is now readable at address x,f7h (read only). [6] reserved [5] wdrs watchdog reset status. this bit may not be set by user code; however, it may be cleared by writing it with a zero (0). 0 no watchdog reset has occurred. 1 watchdog reset has occurred. [4] pors power on reset status. this bit may not be set by user code; however, it may be cleared by writing it with a zero (0). 0 power on reset has not occurred and watchdog timer is enabled. 1 will be set after external reset or power on reset. [3] sleep set by the user to enable the cpu sleep state. cpu will remain in sleep mode until any interrupt is pending. 0 normal operation 1 sleep [2:1] reserved [0] stop 0 m8c is free to execute code. 1 m8c is halted. can only be cleared by por, xres, or wdr. individual register names and addresses cpu_scr0: x,ffh 7 6 5 4 3 2 1 0 access : por r : 0 rc : 0 rc : 1 rw : 0 rw : 0 bit name gies wdrs pors sleep stop bit name description
december 22, 2003 document no. 38-12009 rev. *d 145 cy8c22xxx preliminary data sheet 13. register details 13.2 bank 1 registers the following registers are all in bank 1 and are listed in offset order. 13.2.1 prtxdm0 port drive mode bit register 0 in register prtxdm0 there are eight possible drive modes for each port pin. three mode bits are required to select one of these modes, and these three bits are spread into three different registers (prtxdm0, ?prtxdm1? on page 146 , and ?prtxdm2? on page 89 ). the bit position of the effected port pin (example: pin[2] in port 0) is the same as the bit position of each of the three drive mode register bits that control the drive mode for that pin (example: bit[2] in prt0dm0, bit[2] in prt0dm1 and bit[2] in prt0dm2). the three bits from the three registers are treated as a group. these are referred to as dm2, dm1, and dm0, or together as dm[2:0]. all drive mode bits are shown in the sub-table below ([21 0 ] refers to the combination (in order) of bits in a given bit position); however, this register only controls the least significant bit of the drive mode. for additional information, reference the ?regis- ter definitions? on page 58 in the gpio chapter. [7:0] drive mode 0[7:0] bit 0 of the drive mode, for each of 8-port pins, for a gpio port. [ 21 0] pin output high pin output low notes 00 0 b strong resistive 00 1 b strong strong 01 0 b hi-z hi-z digital input enabled. 01 1 b resistive strong 10 0 b slow + strong hi-z 10 1 b slow + strong slow + strong 11 0 b hi-z hi-z digital input disabled for zero power. reset state. 11 1 b hi-z slow + strong i 2 c compatible mode. note a bold digit, in the table above, signifies that the digit is used in this register. individual register names and addresses prt0dm0 : 1,00h prt1dm0 : 1,04h 7 6 5 4 3 2 1 0 access : por rw : 00 bit name drive mode 0[7:0] bit name description
13. register details cy8c22xxx preliminary data sheet 146 document no. 38-12009 rev. *d december 22, 2003 13.2.2 prtxdm1 port drive mode bit register 1 in register prtxdm1 there are eight possible drive modes for each port pin. three mode bits are required to select one of these modes, and these three bits are spread into three different registers ( ?prtxdm0? on page 145 , prtxdm1, and ?prtxdm2? on page 89 ). the bit position of the effected port pin (example: pin[2] in port 0) is the same as the bit position of each of the three drive mode register bits that control the drive mode for that pin (example: bit[2] in prt0dm0, bit[2] in prt0dm1 and bit[2] in prt0dm2). the three bits from the three registers are treated as a group. these are referred to as dm2, dm1, and dm0, or together as dm[2:0]. all drive mode bits are shown in the sub-table below ([2 1 0] refers to the combination (in order) of bits in a given bit position); however, this register only controls the middle bit of the drive mode. for additional information, reference the ?register defini- tions? on page 58 in the gpio chapter. [7:0] drive mode 1[7:0] bit 1 of the drive mode, for each of 8-port pins, for a gpio port. [ 2 1 0 ] pin output high pin output low notes 0 0 0b strong resistive 0 0 1b strong strong 0 1 0b hi-z hi-z digital input enabled. 0 1 1b resistive strong 1 0 0b slow + strong hi-z 1 0 1b slow + strong slow + strong 1 1 0b hi-z hi-z digital input disabled for zero power. reset state. 1 1 1b hi-z slow + strong i 2 c compatible mode. note a bold digit, in the table above, signifies that the digit is used in this register. individual register names and addresses prt0dm1 : 1,01h prt1dm1 : 1,05h 7 6 5 4 3 2 1 0 access : por rw : ff bit name drive mode 1[7:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 147 cy8c22xxx preliminary data sheet 13. register details 13.2.3 prtxic0 port interrupt control register 0 in register prtxic0 there are four possible interrupt modes for each port pin. two mode bits are required to select one of these modes and these two bits are spread into two different registers (prtxic0 and ?prtxic1? on page 148 ). the bit posi- tion of the effected port pin (example: pin[2] in port 0) is the same as the bit position of each of the interrupt control regi ster bits that control the interrupt mode for that pin (example: bit[2] in prt0ic0 and bit[2] in prt0ic1). the two bits from the two registers are treated as a group. in the sub-table below, ?[ 0 ]? refers to the combination (in order) of bits in a given position, one bit from prtxic1 and one bit from prtxic0. for additional information, reference the ?register definitions? on page 58 in the gpio chapter. [7:0] interrupt control 0[7:0] [1 0 ] interrupt type 0 0 b disabled 0 1 b low 1 0 bhigh ?1 1 b change from last read note a bold digit, in the table above, signifies that the digit is used in this register. individual register names and addresses prt0ic0 : 1,02h prt1ic0 : 1,06h 7 6 5 4 3 2 1 0 access : por rw : 00 bit name interrupt control 0[7:0] bit name description
13. register details cy8c22xxx preliminary data sheet 148 document no. 38-12009 rev. *d december 22, 2003 13.2.4 prtxic1 port interrupt control register 1 in register prtxic1 there are four possible interrupt modes for each port pin. two mode bits are required to select one of these modes and these two bits are spread into two different registers ( ?prtxic0? on page 147 and prtxic1). the bit posi- tion of the effected port pin (example: pin[2] in port 0) is the same as the bit position of each of the interrupt control regi ster bits that control the interrupt mode for that pin (example: bit[2] in prt0ic0 and bit[2] in prt0ic1). the two bits from the two registers are treated as a group. in the sub-table below, ?[ 1 ]? refers to the combination (in order) of bits in a given position, one bit from prtxic1 and one bit from prtxic0. for additional information, reference the ?register definitions? on page 58 in the gpio chapter. [7:0] interrupt control 1[7:0] [ 1 0] interrupt type 0 0b disabled 0 1b low 1 0b high ? 1 1b change from last read note a bold digit, in the table above, signifies that the digit is used in this register. individual register names and addresses prt0ic1 : 1,03h prt1ic1 : 1,07h 7 6 5 4 3 2 1 0 access : por rw : 00 bit name interrupt control 1[7:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 149 cy8c22xxx preliminary data sheet 13. register details 13.2.5 dxbxxfn digital basic/communications type b block function register before changing any of the configuration registers (dxbxxfn, dxbxxin, and dxbxxou), disable the corresponding digital block by setting bit 0 in the cr0 or dxbxxcr0 register to ?0?. the values in the dxbxxfn register should not be changed while the block is enabled. after all configuration changes are made, enable the block by setting bit 0 in the dxbxxcr0 register to ?1?. for additional information, reference the ?register definitions? on page 198 in the digital blocks chapter. [7] data invert 0 data input is non-inverted. 1 data input is inverted. [6] bcen enable primary function output to drive the broadcast net. 0 disable 1 enable [5] end/single 0 block is not the end of a chained function or the function is not chainable. 1 block is the end of a chained function or a standalone block in a chainable function. [4:3] mode[1:0] (function dependent) timer or counter: mode[0] signifies the interrupt type. 0 interrupt on terminal count 1 interrupt on compare true mode[1] signifies the compare type. 0 compare on less than or equal 1 compare on less than crcprs: mode[1:0] are encoded as the compare type. 00b compare on equal 01b compare on less than or equal 10b reserved 11b compare on less than dead band: mode[1:0] are encoded as the kill type. 00b synchronous restart kill mode 01b disable kill mode 10b asynchronous kill mode 11b reserved (continued on next page) individual register names and addresses dbb00fn : 1,20h dbb01fn : 1,24h dcb02fn : 1,28h dcb03fn : 1,2ch 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 bit name data invert bcen end/single mode[1:0] function[2:0] bit name description
13. register details cy8c22xxx preliminary data sheet 150 document no. 38-12009 rev. *d december 22, 2003 13.2.5 dxbxxfn (continued) uart: mode[0] signifies the direction. 0receiver 1 transmitter mode[1] signifies the interrupt type. 0 interrupt on tx reg empty 1 interrupt on tx complete spi: mode[0] signifies the type. 0master 1slave mode[1] signifies the interrupt type. 0 interrupt on tx reg empty 1 interrupt on spi complete [2:0] function[2:0] 000b timer (chainable) 001b counter (chainable) 010b crcprs (chainable) 011b reserved 100b dead band 101b uart (dcbxx blocks only) 110b spi (dcbxx blocks only) 111b reserved
december 22, 2003 document no. 38-12009 rev. *d 151 cy8c22xxx preliminary data sheet 13. register details 13.2.6 dxbxxin digital basic/communications type b block input register before changing any of the configuration registers (dxbxxfn, dxbxxin, and dxbxxou), disable the corresponding digital block by setting bit 0 in the cr0 or dxbxxcr0 register to ?0?. the values in this register should not be changed while the bloc k is enabled. after all configuration changes are made, enable the block by setting bit 0 in the cr0 register to ?1?. for additional information, reference the ?register definitions? on page 198 in the digital blocks chapter. [7:4] data input[3:0] 0h low (0) 1h high (1) 2h row broadcast net 3h chain function to previous block 4h analog column comparator 0 5h analog column comparator 1 6h reserved 7h reserved 8h row output 0 9h row output 1 ah row output 2 bh row output 3 ch row input 0 dh row input 1 eh row input 2 fh row input 3 [3:0] clock input[3:0] 0h clock disabled (low) 1h vc3 2h row broadcast net 3h previous block primary output (low for dbb00) 4h sysclkx2 5h vc1 6h vc2 7h clk32k 8h row output 0 9h row output 1 ah row output 2 bh row output 3 ch row input 0 dh row input 1 eh row input 2 fh row input 3 individual register names and addresses dbb00in : 1,21h dbb01in : 1,25h dcb02in : 1,29h dcb03in : 1,2dh 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 bit name data input[3:0] clock input[3:0] bit name description
13. register details cy8c22xxx preliminary data sheet 152 document no. 38-12009 rev. *d december 22, 2003 13.2.7 dxbxxou digital basic/communications type b block output register before changing any of the configuration registers (dxbxxfn, dxbxxin, and dxbxxou), disable the corresponding digital block by setting bit 0 in the cr0 or dxbxxcr0 register to ?0?. the values in this register should not be changed while the bloc k is enabled. after all configuration changes are made, enable the block by setting bit 0 in the dxbxxcr0 register to ?1?. for additional information, reference the ?register definitions? on page 198 in the digital blocks chapter. [7:6] auxclk 00b no sync 16 to 1 clock mux output 01b synchronize to sysclk output of 16 to 1 clock mux to sysclk 10b synchronize to sysclkx2 output of 16 to 1 clock mux to sysclkx2 11b sysclk directly connect sysclk to block clock input [5] auxen aux io enable (function dependent) all functions except spi slave: enable auxiliary output driver 0 disabled 1 enabled spi slave: slave select input aux io enable, aux io select[1:0] (function dependent, spis only) source for ss_ input 000b auxdata[0] (row input 0) 001b auxdata[1] (row input 1) 010b auxdata[2] (row input 2) 011b auxdata[3] (row input 3) 100b force ss_ active 101b reserved 110b reserved 111b reserved [4:3] aux io select[1:0] all functions except spi slave: row output select for auxiliary function output (function dependent) 00b row output 0 01b row output 1 10b row output 2 11b row output 3 [2] outen enable primary function output driver 0 disabled. 1 enabled. (continued on next page) individual register names and addresses dbb00ou : 1,22h dbb01ou : 1,26h dcb02ou : 1,2ah dcb03ou : 1,2eh 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 bit name auxclk auxen aux io select[1:0]t outen output select[1:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 153 cy8c22xxx preliminary data sheet 13. register details 13.2.7 dxbxxou (continued) [1:0] output select[1:0] row output select for primary function output 00b row output 0 01b row output 1 10b row output 2 11b row output 3
13. register details cy8c22xxx preliminary data sheet 154 document no. 38-12009 rev. *d december 22, 2003 13.2.8 clk_cr0 analog column clock control register 0 each column has two bits that select the column clock input source. the resulting column clock frequency is the selected input clock frequency divided by four. for additional information, reference the ?register definitions? on page 228 in the ana- log interface chapter. [7:4] reserved [3:2] acolumn1[1:0] clock selection for column 1. 00b variable clock 1 (vc1) 01b variable clock 2 (vc2) 10b analog clock 0 (aclk0) 11b analog clock 1 (aclk1) [1:0] reserved individual register names and addresses clk_cr0: 1,60h 7 6 5 4 3 2 1 0 access : por rw : 0 bit name acolumn1[1:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 155 cy8c22xxx preliminary data sheet 13. register details 13.2.9 clk_cr1 analog clock source control register 1 for additional information, reference the ?register definitions? on page 228 in the analog interface chapter. [7] reserved [6] shdis sample and hold disable. 0 enabled 1 disabled [5:3] aclk1[2:0] select the clocking source for analog clock 1. 000b digital psoc block 00 001b digital psoc block 01 010b digital psoc block 02 011b digital psoc block 03 100b reserved 101b reserved 110b reserved 111b reserved [2:0] aclk0[2:0] select the clocking source for analog clock 0. 000b digital psoc block 00 001b digital psoc block 01 010b digital psoc block 02 011b digital psoc block 03 100b reserved 101b reserved 110b reserved 111b reserved individual register names and addresses clk_cr1: 1,61h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 bit name shdis aclk1[2:0] aclk0[2:0] bit name description
13. register details cy8c22xxx preliminary data sheet 156 document no. 38-12009 rev. *d december 22, 2003 13.2.10 abf_cr0 analog output buffer control register 0 for additional information, reference the ?register definitions? on page 61 in the analog output drivers chapter or the ?regis- ter definitions? on page 235 in the analog input configuration chapter. [7] acol1mux 0 set column 1 input to column 1 input mux output. (selects among p0[6,4,2,0]) 1 set column 1 input to column 0 input mux output. (selects among p0[7,5,3,1]) [6] reserved [5] abuf1en0 enables the analog output buffer for analog column 1 (pin p0[5]). 0 disable analog output buffer. 1 enable analog output buffer. [4:2] reserved [1] bypass connects the positive input of the amplifier directly to its output. amplifiers need to be disabled when in bypass mode. 0 disable 1 enable [0] pwr determines power level of all output buffers. 0 low output power 1 high output power individual register names and addresses abf_cr0: 1,62h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 bit name acol1mux abuf1en0 bypass pwr bit name description
december 22, 2003 document no. 38-12009 rev. *d 157 cy8c22xxx preliminary data sheet 13. register details 13.2.11 amd_cr1 analog modulation control register 1 for additional information, reference the ?register definitions? on page 228 in the analog interface chapter. [7:3] reserved [2:0] amod1[2:0] analog modulation control signal selection for column 1. 000b zero (off) 001b global output bus, even bus bit 1 (goe[1]) 010b global output bus, even bus bit 0 (goe[0]) 011b row 0 broadcast bus 100b reserved 101b analog column comparator 1 110b reserved 111b reserved individual register names and addresses amd_cr1: 1,66h 7 6 5 4 3 2 1 0 access : por rw : 0 bit name amod1[2:0] bit name description
13. register details cy8c22xxx preliminary data sheet 158 document no. 38-12009 rev. *d december 22, 2003 13.2.12 alt_cr0 analog lut control register 0 for additional information, reference the ?register definitions? on page 228 in the analog interface chapter. [7:4] lut1[3:0] select one of 16 logic functions for the output of comparator bus 1. note that b=0. 0h false 1h a and b 2h a and b 3h a 4h a and b 5h b 6h a xor b 7h a or b 8h a nor b 9h a xnor b ah b bh a or b ch a dh a or b eh a nand b fh true [3:0] reserved individual register names and addresses alt_cr0: 1,67h 7 6 5 4 3 2 1 0 access : por rw : 0 bit name lut1[3:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 159 cy8c22xxx preliminary data sheet 13. register details 13.2.13 gdi_o_in global digital interconnect odd inputs register for additional information, reference the ?register definitions? on page 179 in the global digital interconnect chapter. [7] gionout7 0 gio[7] does not drive goo[7]. 1 gio[7] drives its value on to goo[7]. [6] gionout6 0 gio[6] does not drive goo[6]. 1 gio[6] drives its value on to goo[6]. [5] gionout5 0 gio[5] does not drive goo[5]. 1 gio[5] drives its value on to goo[5]. [4] gionout4 0 gio[4] does not drive goo[4]. 1 gio[4] drives its value on to goo[4]. [3] gionout3 0 gio[3] does not drive goo[3]. 1 gio[3] drives its value on to goo[3]. [2] gionout2 0 gio[2] does not drive goo[2]. 1 gio[2] drives its value on to goo[2]. [1] gionout1 0 gio[1] does not drive goo[1]. 1 gio[1] drives its value on to goo[1]. [0] gionout0 0 gio[0] does not drive goo[0]. 1 gio[0] drives its value on to goo[0]. individual register names and addresses gdi_o_in: 1,d0h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 bit name gionout7 gionout6 gionout5 gionout4 gionout3 gionout2 gionout1 gionout0 bit name description
13. register details cy8c22xxx preliminary data sheet 160 document no. 38-12009 rev. *d december 22, 2003 13.2.14 gdi_e_in global digital interconnect even inputs register for additional information, reference the ?register definitions? on page 179 in the global digital interconnect chapter. [7] gienout7 0 gie[7] does not drive goe[7]. 1 gie[7] drives its value on to goe [7]. [6] gienout6 0 gie[6] does not drive goe[6]. 1 gie[6] drives its value on to goe [6]. [5] gienout5 0 gie[5] does not drive goe[5]. 1 gie[5] drives its value on to goe [5]. [4] gienout4 0 gie[4] does not drive goe[4]. 1 gie[4] drives its value on to goe [4]. [3] gienout3 0 gie[3] does not drive goe[3]. 1 gie[3] drives its value on to goe [3]. [2] gienout2 0 gie[2] does not drive goe[2]. 1 gie[2] drives its value on to goe [2]. [1] gienout1 0 gie[1] does not drive goe[1]. 1 gie[1] drives its value on to goe [1]. [0] gienout0 0 gie[0] does not drive goe[0]. 1 gie[0] drives its value on to goe [0]. individual register names and addresses gdi_e_in: 1,d1h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 bit name gienout7 gienout6 gienout5 gienout4 gienout3 gienout2 gienout1 gienout0 bit name description
december 22, 2003 document no. 38-12009 rev. *d 161 cy8c22xxx preliminary data sheet 13. register details 13.2.15 gdi_o_ou global digital interconnect odd outputs register for additional information, reference the ?register definitions? on page 179 in the global digital interconnect chapter. [7] gooutin7 0 goo[7] does not drive gio[7]. 1 goo[7] drives its value on to gio[7]. [6] gooutin6 0 goo[6] does not drive gio[6]. 1 goo[6] drives its value on to gio[6]. [5] gooutin5 0 goo[5] does not drive gio[5]. 1 goo[5] drives its value on to gio[5]. [4] gooutin4 0 goo[4] does not drive gio[4]. 1 goo[4] drives its value on to gio[4]. [3] gooutin3 0 goo[3] does not drive gio[3]. 1 goo[3] drives its value on to gio[3]. [2] gooutin2 0 goo[2] does not drive gio[2]. 1 goo[2] drives its value on to gio[2]. [1] gooutin1 0 goo[1] does not drive gio[1]. 1 goo[1] drives its value on to gio[1]. [0] gooutin0 0 goo[0] does not drive gio[0]. 1 goo[0] drives its value on to gio[0]. individual register names and addresses gdi_o_ou: 1,d2h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 bit name gooutin7 gooutin6 gooutin5 gooutin4 gooutin3 gooutin2 gooutin1 gooutin0 bit name description
13. register details cy8c22xxx preliminary data sheet 162 document no. 38-12009 rev. *d december 22, 2003 13.2.16 gdi_e_ou global digital interconnect even outputs register for additional information, reference the ?register definitions? on page 179 in the global digital interconnect chapter. [7] goeutin7 0 goe[7] does not drive gie[7]. 1 goe[7] drives its value on to gie[7]. [6] goeutin6 0 goe[6] does not drive gie[6]. 1 goe[6] drives its value on to gie[6]. [5] goeutin5 0 goe[5] does not drive gie[5]. 1 goe[5] drives its value on to gie[5]. [4] goeutin4 0 goe[4] does not drive gie[4]. 1 goe[4] drives its value on to gie[4]. [3] goeutin3 0 goe[3] does not drive gie[3]. 1 goe[3] drives its value on to gie[3]. [2] goeutin2 0 goe[2] does not drive gie[2]. 1 goe[2] drives its value on to gie[2]. [1] goeutin1 0 goe[1] does not drive gie[1]. 1 goe[1] drives its value on to gie[1]. [0] goeutin0 0 goe[0] does not drive gie[0]. 1 goe[0] drives its value on to gie[0]. individual register names and addresses gdi_e_ou: 1,d3h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 bit name goeutin7 goeutin6 goeutin5 goeutin4 goeutin3 goeutin2 goeutin1 goeutin0 bit name description
december 22, 2003 document no. 38-12009 rev. *d 163 cy8c22xxx preliminary data sheet 13. register details 13.2.17 osc_cr4 oscillator control register 4 for additional information, reference the ?register definitions? on page 256 in the digital clocks chapter. [7:2] reserved [1:0] vc3 input select[1:0] selects the clocking source for the vc3 clock divider. 00b sysclk 01b vc1 10b vc2 11b sysclkx2 individual register names and addresses osc_cr4: 1,deh 7 6 5 4 3 2 1 0 access : por rw : 0 bit name vc3 input select[1:0] bit name description
13. register details cy8c22xxx preliminary data sheet 164 document no. 38-12009 rev. *d december 22, 2003 13.2.18 osc_cr3 oscillator control register 3 the output frequency of the vc3 clock divider is the input frequency divided by the value in this register, plus one. for exam- ple, if this register contains 07h, the clock frequency output from the vc3 clock divider will be one eighth the input frequenc y. for additional information, reference the ?register definitions? on page 256 in the digital clocks chapter. [7:0] vc3 divider[7:0] reference the osc_cr4 register. 00h input clock 01h input clock / 2 02h input clock / 3 03h input clock / 4 ... ... fch input clock / 253 fdh input clock / 254 feh input clock / 255 ffh input clock / 256 individual register names and addresses osc_cr3: 1,dfh 7 6 5 4 3 2 1 0 access : por rw : 00 bit name vc3 divider[7:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 165 cy8c22xxx preliminary data sheet 13. register details 13.2.19 osc_cr0 oscillator control register 0 for additional information, reference the ?register definitions? on page 256 in the digital clocks chapter. [7] 32k select 0 internal low precision 32 khz oscillator 1 external crystal oscillator [6] pll mode 0 disabled 1 enabled. internal main oscillator is frequency locked to external crystal oscillator. [5] no buzz 0 buzz bandgap during power down. 1 bandgap is always powered even during sleep. [4:3] sleep[1:0] sleep interval 00b 1.95 ms (512 hz) 01b 15.6 ms (64 hz) 10b 125 ms (8 hz) 11b 1 s (1 hz) [2:0] cpu speed[2:0] internal main oscillator external clock 000b 3 mhz extclk / 8 001b 6 mhz extclk / 4 010b 12 mhz extclk / 2 011b 24 mhz extclk / 1 100b 1.5 mhz extclk / 16 101b 750 khz extclk / 32 110b 187.5 khz extclk / 128 111b 93.7 khz extclk / 256 individual register names and addresses osc_cr0: 1,e0h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 rw : 0 bit name 32k select pll mode no buzz sleep[1:0] cpu speed[2:0] bit name description
13. register details cy8c22xxx preliminary data sheet 166 document no. 38-12009 rev. *d december 22, 2003 13.2.20 osc_cr1 oscillator control register 1 for additional information, reference the ?register definitions? on page 256 in the digital clocks chapter. [7:4] vc1 divider[3:0] internal main oscillator external clock 0h 24 mhz extclk / 1 1h 12 mhz extclk / 2 2h 8 mhz extclk / 3 3h 6 mhz extclk / 4 4h 4.8 mhz extclk / 5 5h 4 mhz extclk / 6 6h 3.43 mhz extclk / 7 7h 3 mhz extclk / 8 8h 2.67 mhz extclk / 9 9h 2.40 mhz extclk / 10 ah 2.18 mhz extclk / 11 bh 2.00 mhz extclk / 12 ch 1.85 mhz extclk / 13 dh 1.71 mhz extclk / 14 eh 1.6 mhz extclk / 15 fh 1.5 mhz extclk / 16 [3:0] vc2 divider[3:0] internal main oscillator external clock 0h (24 / (osc_cr1[7:4]+1)) / 1 (extclk / (osc_cr1[7:4]+1)) / 1 1h (24 / (osc_cr1[7:4]+1)) / 2 (extclk / (osc_cr1[7:4]+1)) / 2 2h (24 / (osc_cr1[7:4]+1)) / 3 (extclk / (osc_cr1[7:4]+1)) / 3 3h (24 / (osc_cr1[7:4]+1)) / 4 (extclk / (osc_cr1[7:4]+1)) / 4 4h (24 / (osc_cr1[7:4]+1)) / 5 (extclk / (osc_cr1[7:4]+1)) / 5 5h (24 / (osc_cr1[7:4]+1)) / 6 (extclk / (osc_cr1[7:4]+1)) / 6 6h (24 / (osc_cr1[7:4]+1)) / 7 (extclk / (osc_cr1[7:4]+1)) / 7 7h (24 / (osc_cr1[7:4]+1)) / 8 (extclk / (osc_cr1[7:4]+1)) / 8 8h (24 / (osc_cr1[7:4]+1)) / 9 (extclk / (osc_cr1[7:4]+1)) / 9 9h (24 / (osc_cr1[7:4]+1)) / 10 (extclk / (osc_cr1[7:4]+1)) / 10 ah (24 / (osc_cr1[7:4]+1)) / 11 (extclk / (osc_cr1[7:4]+1)) / 11 bh (24 / (osc_cr1[7:4]+1)) / 12 (extclk / (osc_cr1[7:4]+1)) / 12 ch (24 / (osc_cr1[7:4]+1)) / 13 (extclk / (osc_cr1[7:4]+1)) / 13 dh (24 / (osc_cr1[7:4]+1)) / 14 (extclk / (osc_cr1[7:4]+1)) / 14 eh (24 / (osc_cr1[7:4]+1)) / 15 (extclk / (osc_cr1[7:4]+1)) / 15 fh (24 / (osc_cr1[7:4]+1)) / 16 (extclk / (osc_cr1[7:4]+1)) / 16 individual register names and addresses osc_cr1: 1,e1h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 bit name vc1 divider[3:0] vc2 divider[3:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 167 cy8c22xxx preliminary data sheet 13. register details 13.2.21 osc_cr2 oscillator control register 2 note that in ocd mode (ocdm=1), bits [1:0] have no effect. for additional information, reference the ?register definitions? on page 256 in the digital clocks chapter. [7] pllgain phase locked loop gain. 0 recommended value, normal gain. 1 reduced gain to make pll more tolerant to noisy or jittery crystal input. [6:3] reserved [2] extclken external clock mode enable. 0 disabled. operate from internal main oscillator. 1 enabled. operate from clock supplied at port p1[4]. [1] imodis internal oscillator disable. can be set to save power when using an external clock on p1[4]. 0 enabled. internal oscillator enabled. 1 disabled, if sysclkx2dis is set (1). [0] sysclkx2dis 48 mhz clock source disable. 0 enabled. if enabled, the 48 mhz clock is forced on. 1 disabled for power reduction. individual register names and addresses osc_cr2: 1,e2h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 rw : 0 bit name pllgain extclken imodis sysclkx2dis bit name description
13. register details cy8c22xxx preliminary data sheet 168 document no. 38-12009 rev. *d december 22, 2003 13.2.22 vlt_cr voltage monitor control register for additional information, reference the ?register definitions? on page 277 in the por and lvd chapter. [7:6] reserved [5:4] porlev[1:0] sets the por level. 00b por level for 3v operation 01b por level for 4.5v operation 10b por level for 4.75v operation 11b reserved [3] lvdtben enables reset of cpu speed register by lvd comparator output. 0 disables cpu speed throttle-back. 1 enables cpu speed throttle-back. [2:0] vm[2:0] sets the lvdp levels per ?dc por and lvd specifications? on page 294 . 000b typical lvd setting for operation above 3.0v. 001b 010b 011b 100b 101b typical lvd setting for operation above 4.75v (no switch mode pump). 110b 111b typical pump setting for 5v operation. individual register names and addresses vlt_cr: 1,e3h 7 6 5 4 3 2 1 0 access : por rw : 0 rw : 0 rw : 0 bit name porlev[1:0] lvdtben vm[2:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 169 cy8c22xxx preliminary data sheet 13. register details 13.2.23 vlt_cmp voltage monitor comparators register for additional information, reference the ?register definitions? on page 277 in the por and lvd chapter. [7:2] reserved [1] lvd reads state of lvd comparator. 0 vdd is above lvd trip point. 1 vdd is below lvd trip point. [0] ppor reads state of precision por comparator (only useful with ppor reset disabled, with porlev[1:0] in vlt_cr register set to 11b). 0 vdd is above ppor trip voltage. 1 vdd is below ppor trip voltage. individual register names and addresses vlt_cmp: 1,e4h 7 6 5 4 3 2 1 0 access : por r : 0 r : 0 bit name lvd ppor bit name description
13. register details cy8c22xxx preliminary data sheet 170 document no. 38-12009 rev. *d december 22, 2003 13.2.24 imo_tr internal main oscillator trim register for additional information, reference the ?register definitions? on page 63 in the internal main oscillator chapter. [7:0] trim[7:0] the value of this register is used to trim the internal main oscillator. its value is set to the best value for the device during boot. the value in this register should not be changed . 00h lowest frequency setting 01h ... ... 7fh 80h design center setting 81h ... ... feh ffh highest frequency setting individual register names and addresses imo_tr: 1,e8h 7 6 5 4 3 2 1 0 access : por w : 00 bit name trim[7:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 171 cy8c22xxx preliminary data sheet 13. register details 13.2.25 ilo_tr internal low speed oscillator trim register it is strongly recommended that the user not alter this register?s value. the trim bits are set to factory specifications and should not be changed. for additional information, reference the ?register definitions? on page 65 in the internal low speed oscillator chapter. [7:6] reserved [5:4] bias trim[1:0] the value of this register is used to trim the internal low speed oscillator. its value is set to the device specific, best value during boot. the value in this register should not be changed. 00b medium bias 01b maximum bias (recommended) 10b minimum bias 11b reserved [3:0] freq trim[3:0] the value of this register is used to trim the internal low speed oscillator. its value is set to the device specific, best value during boot. the value in this register should not be changed. individual register names and addresses ilo_tr: 1,e9h 7 6 5 4 3 2 1 0 access : por w : 0 w : 00 bit name bias trim[1:0] freq trim[3:0] bit name description
13. register details cy8c22xxx preliminary data sheet 172 document no. 38-12009 rev. *d december 22, 2003 13.2.26 bdg_tr bandgap trim register for additional information, reference the ?register definitions? on page 279 in the internal voltage reference chapter. [7:6] reserved [5:4] tc[1:0] the value of these bits is used to trim the temperature coefficient. their value is set to the best value for the device during boot. the value of these bits should not be changed. [3:0] v[3:0] the value of these bits is used to trim the bandgap reference. their value is set to the best value for the device during boot. the value of these its should not be changed. individual register names and addresses bdg_tr: 1,eah 7 6 5 4 3 2 1 0 access : por rw : 1 rw : 8 bit name tc[1:0] v[3:0] bit name description
december 22, 2003 document no. 38-12009 rev. *d 173 cy8c22xxx preliminary data sheet 13. register details 13.2.27 eco_tr external crystal oscillator trim register the value of this register is used to trim the external crystal oscillator. its value is set to the device specific, best value during boot. the value in this register should not be changed. for additional information, reference the ?register definitions? on page 68 in the 32 khz crystal oscillator chapter. [7:6] pssdc[1:0] sleep duty cycle. controls the ratios (in numbers of 32 khz clock periods) of ?on? time versus ?off? time for porlvd, bandgap reference, and pspump. 00b 1 / 128 01b 1 / 512 10b 1 / 32 11b 1 / 8 [5:0] reserved individual register names and addresses eco_tr: 1,ebh 7 6 5 4 3 2 1 0 access : por w : 0 bit name pssdc[1:0] bit name description
13. register details cy8c22xxx preliminary data sheet 174 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 175 section d digital system the digital system section discusses the digital components of the psoc device and the registers associated with those components. this section encompasses the following chapters: global digital interconnect (gdi) on page 177 array digital interconnect (adi) on page 181 row digital interconnect (rdi) on page 183 digital blocks on page 189 top-level digital architecture the figure below displays the top-level architecture of the psoc?s digital system. each component of the figure is discussed at length in this section. psoc digital system block diagram digital system port 1 port 0 system bus global digital interconnect digital rows digital clocks from core digital psoc block array to analog system db db dc dc digital row
section d digital system cy8c22xxx preliminary data sheet 176 document no. 38-12009 rev. *d december 22, 2003 digital register summary the table below lists all the psoc registers in the digital system. summary table of the digital registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access global digital interconnect (gdi) registers 1,d0h gdi_o_in gionout7 gionout6 gionout5 gionout4 gionout3 gionout2 gionout1 gionout0 rw : 00 1,d1h gdi_e_in gienout7 gienout6 gienout5 gienout4 gienout3 gienout2 gienout1 gienout0 rw : 00 1,d2h gdi_o_ou gooutin7 gooutin6 gooutin5 gooutin4 gooutin3 gooutin2 gooutin1 gooutin0 rw : 00 1,d3h gdi_e_ou goeutin7 goeutin6 goeutin5 goeutin4 goeutin3 goeutin2 goeutin1 goeutin0 rw : 00 digital row registers x,b0h rdi0ri ri3[1:0] ri2[1:0] ri1[1:0] ri0[1:0] rw : 00 x,b1h rdi0syn ri3syn ri2syn ri1syn ri0syn rw : 00 x,b2h rdi0is bcsel[1:0] is3 is2 is1 is0 rw : 00 x,b3h rdi0lt0 lut1[3:0] lut0[3:0] rw : 00 x,b4h rdi0lt1 lut3[3:0] lut2[3:0] rw : 00 x,b5h rdi0ro0 goo5en goo1en goe5en goe1en goo4en goo0en goe4en goe0en rw : 00 x,b6h rdi0ro1 goo7en goo3en goe7en goe3en goo6en goo2en goe6en goe2en rw : 00 digital block registers data and control registers 0,20h dbb00dr0 data[7:0] # : 00 0,21h dbb00dr1 data[7:0] w : 00 0,22h dbb00dr2 data[7:0] # : 00 0,23h dbb00cr0 function control/status bits for selected function[6:0] enable # : 00 1,20h dbb00fn data invert bcen end/single mode[1:0] function[2:0] rw : 00 1,21h dbb00in data input[3:0] clock input[3:0] rw : 00 1,22h dbb00ou auxclk auxen aux io select[1:0] outen output select[1:0] rw : 00 0,24h dbb01dr0 data[7:0] # : 00 0,25h dbb01dr1 data[7:0] w : 00 0,26h dbb01dr2 data[7:0] # : 00 0,27h dbb01cr0 function control/status bits for selected function[6:0] enable # : 00 1,24h dbb01fn data invert bcen end/single mode[1:0] function[2:0] rw : 00 1,25h dbb01in data input[3:0] clock input[3:0] rw : 00 1,26h dbb01ou auxclk auxen aux io select[1:0] outen output select[1:0] rw : 00 0,28h dcb02dr0 data[7:0] # : 00 0,29h dcb02dr1 data[7:0] w : 00 0,2ah dcb02dr2 data[7:0] # : 00 0,2bh dcb02cr0 function control/status bits for selected function[6:0] enable # : 00 1,28h dcb02fn data invert bcen end/single mode[1:0] function[2:0] rw : 00 1,29h dcb02in data input[3:0] clock input[3:0] rw : 00 1,2ah dcb02ou auxclk auxen aux io select[1:0] outen output select[1:0] rw : 00 0,2ch dcb03dr0 data[7:0] # : 00 0,2dh dcb03dr1 data[7:0] w : 00 0,2eh dcb03dr2 data[7:0] # : 00 0,2fh dcb03cr0 function control/status bits for selected function[6:0] enable # : 00 1,2ch dcb03fn data invert bcen end/single mode[1:0] function[2:0] rw : 00 1,2dh dcb03in data input[3:0] clock input[3:0] rw : 00 1,2eh dcb03ou auxclk auxen aux io select[1:0] outen output select[1:0] rw : 00 legend #: access is bit specific. refer to register detail for additional information. x: an ?x? before the comma in the address field indicates that this register can be accessed or written to no matter what bank is used.
december 22, 2003 document no. 38-12009 rev. *d 177 14. global digital interconnect ( gdi ) this chapter discusses the global digital interconnect (gdi) and its associated registers. gdi is the most general level of interconnect configuration available in the psoc mixed signal arrays. global digital interconnect (gdi) consists of four 8-bit bus- ses. two of the busses are input busses, which allow sig- nals to pass from the device pins to the core of the chip. these busses are called global input odd (gio[7:0]) and global input even (gie[7:0]). the other two busses are out- put busses and allow signals to pass from the core of the chip to the device pins. they are called global output odd (goo[7:0]) and global output even (goe[7:0]). the word ?odd? or ?even? in the bus name indicates which device ports the bus connects to. busses with odd in their name connect to all odd numbered ports and busses with even in their name connect to all even numbered ports. note that the word odd or even in the bus name refers to ports and not pins. there are two ends to the global digital interconnect core signals and port pins. an end may be configured as a source or a destination. for example, a gpio pin may be configured to drive a global input or receive its output from a global output. currently there are two types of core signals connected to the global busses. the digital blocks, which may be a source or a destination for a global net, and sys- tem clocks, which may only drive global nets. 14.1 architectural description the primary goal, of the architectural block diagram that fol- lows, is to communicate the relationship between global busses (goe, goo, gie, gio) and pins. note that any glo- bal input may be connected to its corresponding global out- put, using the tri-state buffers located in the corners of the figure. also, global outputs may be shorted to global inputs using these tri-state buffers. the rectangle in the center of the figure represents the array of digital psoc blocks. table 14-1. global digital interconnect (gdi) registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access 1,d0h gdi_o_in gionout7 gionout6 gionout5 gionout4 gionout3 gionout2 gionout1 gionout0 rw : 00 1,d1h gdi_e_in gienout7 gienout6 gienout5 gienout4 gienout3 gienout2 gienout1 gienout0 rw : 00 1,d2h gdi_o_ou gooutin7 gooutin6 gooutin5 gooutin4 gooutin3 gooutin2 gooutin1 gooutin0 rw : 00 1,d3h gdi_e_ou goeutin7 goeutin6 goeutin5 goeutin4 goeutin3 goeutin2 goeutin1 goeutin0 rw : 00
14. global digital interconnect (gdi) cy8c22xxx preliminary data sheet 178 document no. 38-12009 rev. *d december 22, 2003 figure 14-1. global interconnect block diagram p0[6] go gi p0[4] go gi p0[2] go gi p0[7] go gi p0[5] go gi p0[3] go gi p0[1] go gi p0[0] go gi p1[6] go gi p1[4] go gi p1[2] go gi p1[7] go gi p1[5] go gi p1[3] go gi p1[1] go gi p1[0] go gi gie[0] gie[2] gie[4] gie[6] goe[0] goe[2] goe[4] goe[6] goe[7] goe[5] goe[3] goe[1] gie[7] gie[5] gie[3] gie[1] gio[0] gio[2] gio[4] gio[6] goo[0] goo[2] goo[4] goo[6] goo[7] goo[5] goo[3] goo[1] gio[7] gio[5] gio[3] gio[1] even numbered ports odd numbered ports even numbered pins odd numbered pins even numbered pins odd numbered pins gio[7,5,3,1] gie[7,5,3,1] db[7:0] dbi int[23:8] clk32k vc3 acmp[3:0] sysclkx2 vc2 vc1 gio[6,4,2,0] gie[6,4,2,0] goo[7,5,3,1] goe[7,5,3,1] goo[6,4,2,0] goe[6,4,2,0] digital psoc array dbb00 dcb02 dbb01 dcb03
december 22, 2003 document no. 38-12009 rev. *d 179 cy8c22xxx preliminary data sheet 14. global digital interconnect (gdi) 14.2 register definitions 14.2.1 gdi_o_in and gdi_e_in registers the psoc device has a configurable global digital intercon- nect (gdi). using the configuration bits in the gdi_x_in reg- isters, a global input net may be configured to drive its corresponding global output net. for example, there are a total of 16-bits that control the ability of global inputs to drive global outputs. these bits are in the gdi_o_in and gdi_e_in registers. table 14-2 enumerates the meaning of each bit position in either of the gdi_o_in or gdi_e_in registers. for additional information, reference the gdi_o_in register on page 159 and the gdi_e_in register on page 160 . 14.2.2 gdi_o_ou and gdi_e_ou registers additional configuration bits are offered in the gdi_x_ou registers that allow a global output to drive its corresponding global input. for example, there are a total of 16 bits that control the ability of global outputs to drive global inputs. these bits are in the gdi_o_ou and gdi_e_ou registers. tab l e 1 4- 3 enumer- ates the meaning of each bit position in either of the gdi_o_ou or gdi_e_ou registers. the configurability of the gdi does not allow odd and even nets or nets with different indexes to be connected. the fol- lowing are examples of connections that are not possible in the psoc devices. for additional information, reference the gdi_o_ou regis- ter on page 161 and the gdi_e_ou register on page 162 . table 14-2. gdi_x_in register gdi_x_in[0] 0: no connection between gix[0] to gox[0] 1: allow gix[0] to drive gox[0] gdi_x_in[1] 0: no connection between gix[1] to gox[1] 1: allow gix[1] to drive gox[1] gdi_x_in[2] 0: no connection between gix[2] to gox[2] 1: allow gix[2] to drive gox[2] gdi_x_in[3] 0: no connection between gix[3] to gox[3] 1: allow gix[3] to drive gox[3] gdi_x_in[4] 0: no connection between gix[4] to gox[4] 1: allow gix[4] to drive gox[4] gdi_x_in[5] 0: no connection between gix[5] to gox[5] 1: allow gix[5] to drive gox[5] gdi_x_in[6] 0: no connection between gix[6] to gox[6] 1: allow gix[6] to drive gox[6] gdi_x_in[7] 0: no connection between gix[7] to gox[7] 1: allow gix[7] to drive gox[7] gie 7 [] goe 7 [] table 14-3. gdi_x_ou register gdi_x_ou[0] 0: no connection between gix[0] to gox[0] 1: allow gox[0] to drive gix[0] gdi_x_ou[1] 0: no connection between gix[1] to gox[1] 1: allow gox[1] to drive gix[1] gdi_x_ou[2] 0: no connection between gix[2] to gox[2] 1: allow gox[2] to drive gix[2] gdi_x_ou[3] 0: no connection between gix[3] to gox[3] 1: allow gox[3] to drive gix[3] gdi_x_ou[4] 0: no connection between gix[4] to gox[4] 1: allow gox[4] to drive gix[4] gdi_x_ou[5] 0: no connection between gix[0] to gox[5] 1: allow gox[5] to drive gix[5] gdi_x_ou[6] 0: no connection between gix[6] to gox[6] 1: allow gox[6] to drive gix[6] gdi_x_ou[7] 0: no connection between gix[7] to gox[7] 1: allow gox[7] to drive gix[7] goe 7 [] gie 7 [] goe 7 [] gio 7 [] goe 0 [] gie 7 []
14. global digital interconnect (gdi) cy8c22xxx preliminary data sheet 180 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 181 15. array digital interconnect ( adi ) this chapter presents the array digital interconnect (adi). the digital psoc array uses a scalable architecture that is designed to support from one to four digital psoc rows, as defined in the row digital interconnect (rdi) chapter on page 183 . the digital psoc array does not have any configurable interconnect; therefore, there are no associated registers. 15.1 architectural description the array digital interconnect (adi) is shown in figure 15-1 . the adi is not configurable; therefore, the information in this chapter is provided to improve the reader?s understanding of the structure. figure 15-1. digital psoc block array structure the different members of the psoc family have varying numbers of digital psoc blocks in the digital array. these blocks are arranged into rows and the adi provides a regu- lar interconnect architecture between the global digital interconnect (gdi) and the row digital interconnect (rdi), regardless of the number of rows available in a particular device. the most important aspect of the adi and the digital psoc rows is that all digital psoc rows have the same con- nections to global inputs and outputs. the connections that make a row?s position unique are explained in the following bulleted list. register address: clearly rows and the blocks within them need to have unique register addresses. interrupt priority: each digital psoc block has its own interrupt priority and vector. a row?s position in the array determines the relative priority of the digital psoc blocks within the row. the lower the row number the higher the interrupt priority and the lower the interrupt vector address. broadcast: each digital psoc row has an internal broad- cast net that may be either driven internally, by one of the four digital psoc blocks, or driven externally. in the case where the broadcast net is driven externally, the source may be any one of the other rows in the array. therefore, depending on the row?s position in the array, it will have different options for driving its broadcast net. chaining position: rows in the array form a string of dig- ital blocks equal in length to the number of rows multi- plied by four. the first block in the first row and the last block in the last row are not connected; therefore, the array does not form a circle. the first row in the array will have its previous chaining inputs tied low. if there is a second row in the array, the next chaining outputs will be connected to the next row. for the last row in the array, the next inputs are tied low. low low low low bcrow0 hi hi hi i n t [ 1 1 : 8 ] gio[7:0] gie[7:0] db[7:0] dbi int[23:8] goo[7:0] goe[7:0] goe[7:0] goo[7:0] digital psoc block row 0 gio[7:0] gle[7:0] bcrow1 bcrow2 bcrow3 bcw previous block clk previous block data fpb tpb db[7:0] dbi tnb fnb int[3:0] dbb00 dcb02 dbb01 dcb03 bcrow0 bcrow0 vc2 vc1 vc3 vc1 vc2 clk32k clk32k vc3 acmp[3:0] acmp[3:0] sysclkx2 sysclkx2
15. array digital interconnect (adi) cy8c22xxx preliminary data sheet 182 document no. 38-12009 rev. *d december 22, 2003 in figure 15-1 , the detailed view of a digital psoc block row has been replaced by a box labeled ?digital psoc block row.? the rest of this figure illustrates how all rows are con- nected to the same globals, clocks, and so on. the figure also illustrates how the broadcast clock nets (bcxxxx) are connected between rows.
december 22, 2003 document no. 38-12009 rev. *d 183 16. row digital interconnect ( rdi ) this chapter explains the row digital interconnect (rdi) and its associated registers. this chapter discusses a single digital psoc block row. it does not discuss the functions, inputs, or outputs for individual digital psoc blocks. information about ind i- vidual digital psoc blocks is covered in the digital blocks chapter on page 189 . many signals pass through the digital psoc block row on their way to or from individual digital blocks. however, only a small number of signals pass though configurable circuits on their way to and from digital blocks. the configurable circuits allow for greater flexibility in the connections between digital blocks and global busses. what follows is a discussion of the signals that are configurable by way of the registers listed in table 16-1 . 16.1 architectural description in figure 16-1 , within a digital psoc block row, there are four digital psoc blocks. the first two blocks are of the type basic (dbb). the second two are of the type communication (dcb). this figure shows the connections between digital blocks within a row. only the signals that pass through the bold line in figure 16-1 are shown at the next level of hierar- chy ( figure 16-2 on page 185 ). table 16-1. digital psoc row registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access x,xxh rdixri ri3[1:0] ri2[1:0] ri1[1:0] ri0[1:0] rw : 00 x,xxh rdixsyn ri3syn ri2syn ri1syn ri0syn rw : 00 x,xxh rdixis bcsel[1:0] is3 is2 is1 is0 rw : 00 x,xxh rdixlt0 lut1[3:0] lut0 [3:0] rw : 00 x,xxh rdixlt1 lut3[3:0] lut2 [3:0] rw : 00 x,xxh rdixro0 goo5en goo1en goe5en goe1en goo4en goo0en goe4en goe0en rw : 00 x,xxh rdixro1 goo7en goo3en goe7en goe3en goo6en goo2en goe6en goe2en rw : 00 legend x: an ?x? before the comma in the address field indicates that the register exists in both register banks. xx: an ?x? after the comma in the address field indicates that there are multiple instances of the register. for a detailed add ress listing of these registers, refer to the ?digital register summary? on page 176 .
16. row digital interconnect (rdi) cy8c22xxx preliminary data sheet 184 document no. 38-12009 rev. *d december 22, 2003 in figure 16-2 , the detailed view of the four psoc block grouping, as seen in figure 16-1 , has been replaced by the box in the center of the figure labeled ?4 psoc block group- ing.? the rest of the configurable nature of the row inputs (ri), row outputs (ro), and broadcast clock net (bc) is shown. the next level of hierarchy is shown in figure 16-1 . figure 16-1. detailed view of four psoc block groupings clks[15:0] datas[15:0] chaining signals digital psoc block 0 db[7:0] inputs int ro[3:0] auxdata[3:0] to next block from next block from previous block to previous block bus interface input signals output signals broadcast db[7:0] dbi tpb fpb aux[3:0] data[15:0] clk[15:0] tnb fnb ro[3:0] int[3:0] bc clks[15:0] datas[15:0] chaining signals digital psoc block 1 db[7:0] inputs int ro[3:0] auxdata[3:0] to next block from next block from previous block to previous block bus interface input signals output signals broadcast clks[15:0] datas[15:0] chaining signals digital psoc block 2 db[7:0] inputs int ro[3:0] auxdata[3:0] to next block from next block from previous block to previous block bus interface input signals output signals broadcast clks[15:0] datas[15:0] chaining signals digital psoc block 3 db[7:0] inputs int ro[3:0] auxdata[3:0] to next block from next block from previous block to previous block bus interface input signals output signals broadcast basic basic communications communications
december 22, 2003 document no. 38-12009 rev. *d 185 cy8c22xxx preliminary data sheet 16. row digital interconnect (rdi) figure 16-2. digital psoc block row structure goe[0] goo[4] goo[0] goe[4] l0 ri[0] | ro[0] goe[1] goo[5] goo[1] goe[5] l1 goe[2] goo[6] goo[2] goe[6] l2 goe[3] goo[7] goo[3] goe[7] l3 digital psoc block row gie[0] glo[4] glo[0] gle[4] ri[0] gie[1] glo[5] glo[1] gle[5] ri[1] gie[2] glo[6] glo[2] gle[6] ri[2] gie[3] glo[7] glo[3] gle[7] ri[3] bcrow 0 bcrow db[7:0] dbi tpb fpb aux[3:0] data[15:0] clk[15:0] tnb fnb ro[3:0] int[3:0] bcrow 4 psoc block grouping high vc3 broadcast previous block clk* sysclkx2 vc1 vc2 clk32k ro[3:0] ri[3:0] acmp[3:0] low previous block data* ri[3] | ro[3] ri[2] | ro[2] ri[1] | ro[1] ro[0] ro[3] ro[2] ro[1] fpb tpb db[7:0] dbi tnb fnb int[3:0] * "previous" inputs always come from the previous block. therefore, block 0's inputs come from the previous row, while block 1's inputs come from block 0, etc. if there is no previous block (i.e., there is no row above the current row), previous inputs are tied low. the chaining inputs fpb and fnb are also tied low when there is no previous block or next block. dbbx0 dcbx2 dbbx1 dcbx3 s0 s1 s2 s3 keeper[3:0] resets to 1 keeper resets to 1 row bcrow 1 bcrow 2 bcrow 3 4 x 1 mux
16. row digital interconnect (rdi) cy8c22xxx preliminary data sheet 186 document no. 38-12009 rev. *d december 22, 2003 16.2 register definitions the only configurable inputs to a digital psoc block row are the global input even and global input odd 8-bit bus- ses. the only configurable outputs from the digital psoc block row are the global output even and global output odd 8-bit busses. figure 16-2 on page 185 illustrates the relationships between global signals and row signals. notice on the left side of figure 16-2 that global inputs (gie[n] and gio[n]) are inputs to 4-to-1 multiplexers. the output of these multiplexers are row inputs (ri[x]). because there are four 4-to-1 multiplexers, each with a unique set of inputs, a row has access to every global input line in a psoc device. for a complete list of the digital row registers showing their addresses and bit names, reference the ?digital register summary? on page 176 . 16.2.1 rdixri register the select bits used to control the four multiplexers are located in the rdixri register, where ?x? denotes a place holder for the row index. ta b l e 1 6 - 2 lists the meaning for each multiplexer?s four possible settings. the rdixri and rdixsyn registers are the only two regis- ters that affect digital psoc row input signals. all other reg- isters are related to output signal configuration. the options, with respect to output signals, are discussed below. for additional information, reference the rdixri register on page 118 . 16.2.2 rdixsyn register by default, each row input is double synchronized to the sysclk (system clock). however, a user may choose to disable this synchronization by setting the appropriate rix- syn bit in the rdixsyn register. tab l e 1 6- 3 lists the bit meanings for each implemented bit of the rdixsyn register. the rdixri and rdixsyn registers are the only two regis- ters that affect digital psoc row input signals. all other reg- isters are related to output signal configuration. the options, with respect to output signals, are discussed below. for additional information, reference the rdixsyn register on page 119 . 16.2.3 rdixis register as mentioned previously, each lut has two inputs, where one of the inputs is configurable (input a) and the other input (input b) is fixed to a row output. the configurable lut input (input a) chooses between a single row output and a single row input. table 16-4 lists the options for each lut in a row. the bits are labeled is, meaning input select. the lut?s fixed input is always the ro[lut number + 1], i.e., lut0?s fixed input is ro[1], lut1?s fixed input is ro[2],..., and lut3?s fixed input is ro[0]. for additional information, reference the rdixis register on page 120 . table 16-2. rdixri register ri0[1:0] 0h: gie[0] 1h: gie[4] 2h: gio[0] 3h: gio[4] ri1[1:0] 0h: gie[1] 1h: gie[5] 2h: gio[1] 3h: gio[5] ri2[1:0] 0h: gie[2] 1h: gie[6] 2h: gio[2] 3h: gio[6] ri3[1:0] 0h: gie[3] 1h: gie[7] 2h: gio[3] 3h: gio[7] table 16-3. rdixsyn register ri3syn 0: row input 3 in synchronized to 24 mhz system clock 1: row input 3 is passed without synchronization ri2syn 0: row input 2 in synchronized to 24 mhz system clock 1: row input 2 is passed without synchronization ri1syn 0: row input 1 in synchronized to 24 mhz system clock 1: row input 1 is passed without synchronization ri0syn 0: row input 0 in synchronized to 24 mhz system clock 1: row input 0 is passed without synchronization table 16-4. rdixis register bits bcsel[1:0] 0: row 0 driver local row broadcast net* 1: row 1 driver local row broadcast net* 2: row 2 driver local row broadcast net* 3: row 3 driver local row broadcast net* is3 0: the ?a? input of lut 3 is ro[3] 1: the ?a? input of lut 3 is ri[3] is2 0: the ?a? input of lut 2 is ro[2] 1: the ?a? input of lut 2 is ri[2] is1 0: the ?a? input of lut 1 is ro[1] 1: the ?a? input of lut 1 is ri[1] is0 0: the ?a? input of lut 0 is ro[0] 1: the ?a? input of lut 0 is ri[0] * when the bcsell value is equal to the row number, the tri-state buffer that drives the row broadcast net from the input select mux, is disabled, so that one of the row?s blocks may drive the local row broadcast net. * if the row is not present in the part, the selection provides a logic 1 value.
december 22, 2003 document no. 38-12009 rev. *d 187 cy8c22xxx preliminary data sheet 16. row digital interconnect (rdi) 16.2.4 rdixltx registers the outputs from a digital psoc row are a bit more compli- cated than the inputs. figure 16-2 on page 185 illustrates the output circuitry in a digital psoc row. notice in the fig- ure a block labeled ?lx.? this block represents a 2-input lookup table (lut). the lut allows the user to specify any one of 16 logic functions that should be applied to the two inputs. the output of the logic function will determine the value that may be driven on to the global output even and global output odd busses. ta b l e 1 6 - 5 lists the relationship between a lookup table?s four configuration bits and the resulting logic function. some users may find it easier to determine the proper configuration bits setting by remem- bering that the configuration?s bits represent the output col- umn of a two input logic truth table. table 16-5 lists seven examples of the relationship between the lut?s output col- umn for a truth table and the lutx[3:0] configuration bits. for additional information, reference the rdixlt0 register on page 121 and the rdixlt1 register on page 122 . 16.2.5 rdixrox registers the final configuration bits for outputs from digital psoc rows are in the two rdixrox registers. these registers hold the 16 bits and can individually enable the tri-state buff- ers that connect to all eight of the global output even lines and all eight of the global output odd lines. this means that any row can drive any global output. keep in mind that tri- state drivers are being used to drive the global output lines; therefore, it is possible for a part, with more than one digital psoc row, to have multiple drivers on a single global output line. it is the user?s responsibility to ensure that the part is not configured with multiple drivers on any of the global out- put lines. for additional information, reference the rdixro0 register on page 123 and the rdixro1 register on page 124 . 16.3 timing diagram figure 16-3. optional row input synchronization to sysclk table 16-5. example lut truth tables a b and or a+b a&b a b true 000010001 010100011 100111101 111110111 lutx[3:0]1h7hbh2h3h5hfh table 16-6. rdixltx register lutx[3:0] 0h: 0000: false 1h: 0001: a .and. b 2h: 0010: a .and. b 3h: 0011: a 4h: 0100: a .and. b 5h: 0101: b 6h: 0110: a .xor. b 7h: 0111: a .or. b 8h: 1000: a .nor. b 9h: 1001: a .xnor. b ah: 1010: b bh: 1011: a .or. b ch: 1100: a dh: 1101: a .or. b eh: 1110: a. nand. b fh: 1111: true sysclk global input row input set up to positive edge. output of the synchronizer changes on the second positive edge that follows the input transition.
16. row digital interconnect (rdi) cy8c22xxx preliminary data sheet 188 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 189 17. digital blocks this chapter presents the digital blocks and their associated registers. it covers the configuration and use of the digital pso c blocks. all digital psoc blocks may be configured to perform any one of five basic functions: timer, counter, pulse width modu- lator (pwm), pseudo random sequence (prs), or cyclic redundancy check (crc). these functions may be used by configuring an individual psoc block or chaining several psoc blocks together to form functions that are greater than 8 bits. digital communications psoc block have two addi- tional functions: master or slave spi and a full duplex uart. each digital psoc block?s function is independent of all other psoc blocks. up to seven registers are used to deter- mine the function and state of a digital psoc block. these registers are summarized in table 17-1 . digital psoc block function registers end with fn. the individual bit settings for a blocks function register are listed in table 17-15 on page 203 . the input register?s name ends with in and its bit meanings are listed in table 17-15 on page 203 . finally the blocks outputs are controlled by the output register which always ends with ou. each digital psoc block also has three data registers (dr0, dr1, and dr2) and one control register (cr0). the bit meanings for these registers are heavily function dependant and are discussed with each functions description. in addition to seven registers that control the digital psoc block?s function and state a separate interrupt mask bit is available for each digital psoc block. each digital psoc block has a unique interrupt vector and therefore can have its own interrupt service routine. 17.1 architectural description at the top level, the main components of the digital block are the data path, input multiplexers, output de-multiplexers, crcprs tri-state buses, system bus interface, configura- tion registers, and chaining signals (see figure 17-2 ). 17.1.1 input multiplexers typically, each function has a clock and a data input that may be selected from a variety of sources. each of these inputs is selected with a 16-1 input multiplexer. in addition, there is a 4-1 multiplexer that provides an auxil- iary input for the spi slave function that requires three inputs: clock, data, and ss_ (unless the ss_ is forced active with the aux io enable bit). the inputs to this multi- plexer are intended to be a selection of gpio inputs (row inputs). table 17-1. digital psoc block registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access data and control registers 0,xxh dxbxxdr0 data[7:0] # : 00 0,xxh dxbxxdr1 data[7:0] w : 00 0,xxh dxbxxdr2 data[7:0] # : 00 0,xxh dxbxxcr0 function control/status bits for selected function[6:0] enable # : 00 0,e1h int_msk1 dcb03 dcb02 dbb01 dbb00 rw : 00 configuration registers 1,xxh dxbxxfn data invert bcen end/single mode[1:0] function[2:0] rw : 00 1,xxh dxbxxin data input[3:0] clock input[3:0] rw : 00 1,xxh dxbxxou auxclk auxen aux io select[1:0] outen output select[1:0] rw : 00 legend #: access is bit specific. refer to the register detail for additional information. xx: an ?x? after the comma in the address field indicates that there are multiple instances of the register. for an expanded ad dress listing of these registers, refer to the ?digital register summary? on page 176 .
17. digital blocks cy8c22xxx preliminary data sheet 190 document no. 38-12009 rev. *d december 22, 2003 note 1 if the input data source for a given block comes from another block, the destination block must be enabled prior to the source block being enabled. 17.1.2 input clock resynchronization digital blocks allow a clock selection from one of 16 sources. possible sources are the system clocks (vc1, vc2, vc3, sysclk, and sysclkx2), pin inputs, and other digital block outputs. to manage clock skew and ensure that the interfaces between blocks meet timing in all cases, all digital block input clocks must be resynchronized to either sysclk or sysclkx2, which are the source clocks for all chip clocking. also, sysclk or sysclkx2 may be used directly. the auxclk bits in the dxbxxou register are used to specify the input synchronization. the following rules apply to the use of input clock resynchronization. 1. if the clock input is derived (e.g., divided down) from sysclk, re-synchronize to sysclk at the digital block. most chip clocks are in this category. for example, vc1 and vc2, and the output of other blocks clocked by vc1 and vc2 or sysclk (setting 01 in auxclk). 2. if the clock input is derived from sysclkx2, re-synchro- nize to sysclkx2. for example, vc3 clocked by sysclkx2, or other digital blocks clocked by sysclkx2 (setting 10 in auxclk). 3. choose direct sysclk (setting 11 in auxclk). 4. choose direct sysclkx2 (select sysclkx2 in the clock input field of the dxbxxin register). 5. bypass synchronization. this should be a very rare selection. because if clocks are not synchronized, they may fail setup to cpu read and write commands. how- ever, it is possible for an external pin to asynchronously clock a digital block. for example, if the user is willing to synchronize cpu interaction through interrupts or other techniques (setting 00 in auxclk). the following notes enumerate configurations that are not allowed, although the hardware does not prevent them. the summary of these notes is that the clock dividers (vc1, vc2, and vc3) may not be configured in such a way as to create an output clock that is equal to sysclk or sysclkx2. note 1 when vc1 is configured to divide by one, choosing an input clock of vc1 is not allowed. this configuration pro- duces a clock frequency that is equal to sysclk; therefore, sysclk direct should be used by setting the auxclk bits in dxbxou to 11b. note 2 when both vc2 and vc1 are configured to divide by one, choosing an input clock of vc2 is not allowed. this configuration produces a clock frequency that is equal to sysclk; therefore, sysclk direct should be used by set- ting the auxclk bits in dxbxou to 11b. note 3 when vc3 is configured to divide by one with a source clock of sysclk, choosing an input clock of vc3 is not allowed. this configuration produces a clock frequency that is equal to sysclk. there are two other vc3 configu- rations to avoid that will result in an output frequency equal to sysclk. the first is when vc3 is configured to divide by one with a source clock of vc1 divide by one. the second is when vc3 is configured to divide by one with a source clock of vc2 divide by one and vc1 is also configured to divide by one. all of these configurations result in a vc3 frequency equal to sysclk and this is not allowed. when a frequency equal to sysclk is desired, sysclk direct should be used by setting the auxclk bits in dxbxou to 11b. note 4 when vc3 is configured to divide by one with a source clock of sysclkx2, choosing an input clock of vc3 is not allowed. this configuration produces a clock fre- quency that is equal to sysclkx2. when a frequency equal to sysclkx2 is desired, sysclkx2 should be selected by setting the clock input bits of the dxbxxin regis- ter to 4h and the auxclk bits of dxbxou to 00b. all of these issues have been addressed in the actual clock resynchronizer, illustrated in figure 17-1 . figure 17-1. input clock resynchronization 16-1 clk mux 4-1 auxclk mux sysclk sysclk2 blk clk 2-1 sel_sysclk2 0 1 sysclk 00 = bypass 01 = sysclk 10 = sysclk2 sysclk2 11 = sysclk direct current decoding table 17-2: auxclk bit selections code description usage 00 bypass use this setting only for asynchronous inputs. also used when sysclk2 (48 mhz) is selected. 01 resync to sysclk (24 mhz) use this setting for any sysclk based clock. vc1, vc2, vc3 driven by sysclk, digital blocks with sysclk based source clocks, broadcast bus with source based on sysclk, row input and row outputs with source based on sysclk. 10 resync to sysclk2 (48 mhz) use this setting for any sysclk2 based clock. vc3 driven by sysclk2, digital blocks with sysclk2 based source clocks, broadcast bus with source based on sysclk2, row input and row outputs with source based on sysclk2. 11 sysclk direct use this setting to clock the block directly using sysclk. note that this setting is not strictly related to clock resynchroniz ation, but since sysclk cannot resync itself, it allows a direct skew controlled sysclk source.
december 22, 2003 document no. 38-12009 rev. *d 191 cy8c22xxx preliminary data sheet 17. digital blocks 17.1.3 output de-multiplexers most functions have two outputs: a primary and an auxiliary output. each of these outputs may be driven onto the row output bus. each de-multiplexer is implemented with four tri- state drivers. there are two bits to select one of the four and an additional bit to enable the selected driver. figure 17-2. digital blocks top-level block diagram 17.1.4 block chaining signals each digital block has the capability to be chained and to create functions with bit widths greater than eight. there are signals to propagate information, such as compare, carry, enable, capture and gate, from one block to the next to implement higher precision functions. the selection made in the function register determines which signals are appropri- ate for the desired function. user modules that have been designed to implement digital functions, with greater than 8- bit width, will automatically make the proper selections of the chaining signals, to ensure the correct information flow between blocks. 16-1 mux 16-1 mux 4-1 mux 1-4 dmux 1-4 dmux clk data aux_data f1 f2 ci cmpi eni co cmpo eno digital psoc block internal signals for data, carry, compare, enable, capture, and gate chaining to next block. internal signals for carry, compare, enable, capture, and gate chaining from previous block. data select aux data select clock select do int block interrupt primary function output, clock chaining to next block. configuration registers function[7:0] input[7:0] output[7:0] cgi bc broadcast output ro[3:0] ro[3:0] clk resync
17. digital blocks cy8c22xxx preliminary data sheet 192 document no. 38-12009 rev. *d december 22, 2003 17.1.5 timer function a timer consists of a period register, a synchronous down counter, and a capture/compare register, all of which are byte wide. when the timer is disabled and a period value is written into dr1, the period value is also loaded into dr0. when the timer is enabled, the counter counts down until positive terminal count (a count of 00h) is reached. on the next clock edge, the period is reloaded and on subsequent clocks counting continues. the terminal count signal is the primary function output. hardware capture occurs on the positive edge of the data input. this event transfers the current count from dr0 to dr2. the captured value may then be read directly from dr2. a software capture function is equivalent to a hard- ware capture. a cpu read of dr0, with the timer enabled, triggers the same capture mechanism. the hardware and software capture mechanisms are or?ed in the capture cir- cuitry. since the capture circuitry is positive edge sensitive, during an interval where the hardware capture input is high, a software capture is masked and will not occur. the timer also implements a compare function between dr0 and dr2. the compare signal is the auxiliary function output. a limitation, in regards to the compare function, is that the capture and compare function both use the same register (dr2). therefore, if a capture event occurs, it will overwrite the compare value. mode bit 1 in the function register sets the compare type (dr0 <= dr2 or dr0 < dr2) and mode bit 0 sets the inter- rupt type (terminal count or compare). timers may be chained in 8-bit lengths up to 32 bits. 17.1.5.1 usability exceptions the following are usability exceptions for the timer function. 1. capture operation is not supported at 48 mhz. 2. dr2 is not writeable when the timer is enabled. 17.1.5.2 block interrupt the timer block has a selection of three interrupt sources. interrupt on terminal count (tc) and compare may be selected in mode bit 0 of the function register. the interrupt on capture may be selected with the capture interrupt bit in the control register. interrupt on terminal count: the positive edge of termi- nal count (primary output) generates an interrupt for this block. the timing of the interrupt follows the tc pulse width setting in the control register. interrupt on compare: the positive edge of compare (auxiliary output) generates an interrupt for this block. interrupt on capture: hardware or software capture gen- erates an interrupt for this block. the interrupt occurs at closing of the dr2 latch on capture. 17.1.6 counter function a counter consists of a period register, a synchronous down counter, and a compare register. the counter function is identical to the timer function except for the following points: the data input is a counter gate (enable), rather than a capture input. counters do not implement synchronous capture. the dr0 register in a counter should not be read when it is enabled. the compare output is the primary output and the termi- nal count is the auxiliary output (opposite of the timer). terminal count output is full cycle only. when the counter is disabled and a period value is written into dr1, the period value is also loaded into dr0. when the counter is enabled, the counter counts down until termi- nal count (a count of 00h) is reached. on the next clock edge, the period is reloaded and, on subsequent clocks, counting continues. the counter implements a compare function between dr0 and dr2. the compare signal is the primary function out- put. mode bit 1 sets the compare type (dr0 <= dr2 or dr0 < dr2) and mode bit 0 sets the interrupt type (terminal count or compare). the data input functions as a gate to counter operation. the counter will only count and reload when the data input is asserted (logic '1'). when the data input is negated (logic '0'), counting (including the period reload) is halted. counters may be chained in 8-bit blocks up to 32 bits. 17.1.6.1 usability exceptions the following are usability exceptions for the counter func- tion. 1. dr0 may only be read (to transfer dr0 data to dr2) when the block is disabled. 17.1.6.2 block interrupt the counter block has a selection of three interrupt sources. interrupt on terminal count and compare may be selected in mode bit 0 of the function register. interrupt on terminal count: the positive edge of termi- nal count (auxiliary output) generates an interrupt for this block. the timing of the interrupt follows the tc pulse width setting in the control register. interrupt on compare: the positive edge of compare (primary output) generates an interrupt for this block.
december 22, 2003 document no. 38-12009 rev. *d 193 cy8c22xxx preliminary data sheet 17. digital blocks 17.1.7 dead band function the dead band function generates output signals on both the primary and auxiliary outputs of the block, see figure 17-3 . each of these outputs is one phase of a two- phase, non-overlapping clock generated by this function. the two clock phases are never high at the same time and the period between the clock phases is known as the dead band. the width of the dead band time is determined by the value in the period register. this dead band function can be driven with a pwm as an input clock or it can be clocked directly by toggling a bit in software using the bit-bang inter- face. if the clock source is a pwm, this will make a two out- put pwm with guaranteed non-overlapping outputs. an active signal on the ?kill? input will disable both outputs immediately. the pwm with the dead band user module configures one or two blocks to create an 8- or 16-bit pwm and configures an additional block as the dead band function. a dead band consists of a period register, a synchronous down counter, and a special dead band circuit. the dr2 register is only used to read the contents of dr0. as with the timer, when the dead band is disabled and a period value is written into dr1, the period value is also loaded into dr0. figure 17-3. dead band functional overview the dead band has two inputs: a pwm reference signal and a kill signal. the pwm reference signal may be derived from one of two sources. by default, it is hardwired to be the primary output of the previous block. this previous block output is wired as an input to the 16-1 clock input mul- tiplexer. in the dead band case, this signal (prevf1) is wired directly to the dead band reference input. if this mode is used, a pwm or some other waveform generator, must be instantiated in the previous digital block. there is also an optional bit bang mode. in this mode, firmware toggles a register bit to generate a pwm reference and therefore, the dead band may be used as a stand-alone block. the kill signal is derived from the data input signal to the block. mode [1:0] is encoded as the kill type. in all cases, the output is forced low immediately. mode bits are encoded for kill options and are detailed in the following table. when the block is initially enabled, both outputs are low. after enabling, a positive or negative edge of the incoming pwm reference enables the counter. the counter counts down from the period value to terminal count. at terminal count, the counter is disabled and the selected phase is asserted high. on the opposite edge of the pwm input, the output that was high is negated low and the process is repeated with the opposite phase. this results in the gener- ation of a two phase non-overlapping clock matching the fre- quency and pulse width of the incoming pwm reference, but separated by a dead time derived from the period and the input clock. there is a deterministic relationship between the incoming pwm reference and the output phases. the positive edge of the reference causes the primary output to be asserted to '1' and the negative edge of the reference causes the auxiliary output to be asserted to '1'. when asserted, the kill signal functions as an immediate disable of the outputs (forced to logic '0'). there are three optional modes for resuming operation after the kill. these are described in detail in the following section. note that the dead band function may not be chained. d e a d b a n d d e a d b a n d d e a d b a n d d e a d b a n d d e a d b a n d primary output auxiliary output dead band function table 17-3. dead band kill options mode [1:0] description 00b synchronous restart kill mode. internal state is reset and reference edges are ignored until the kill signal is negated. 01b disable kill mode. block is disabled. kill signal must be negated and user must re-enable the block in firmware to resume operation. 10b asynchronous kill mode. outputs are low only for the dura- tion that the kill signal is asserted, subject to a minimum disable time between one-half to one and one-half clock cycles. internal state is unaffected. 11b reserved
17. digital blocks cy8c22xxx preliminary data sheet 194 document no. 38-12009 rev. *d december 22, 2003 17.1.7.1 usability exceptions the following are usability exceptions for the dead band function. 1. programming a dead band period value of 00h is not supported. the block output is undefined under this con- dition. 2. if the period, of either the high time or the low time of the reference input, is less than the programmed dead time that associated output phase will be held low. 3. dr0 may only be read (to transfer dr0 data to dr2) when the block is disabled. 17.1.7.2 block interrupt the dead band has one fixed interrupt source, which is the phase 1 primary output clock. when the kill signal is asserted, the interrupt follows the same behavior of the phase 1 output with respect to the various kill modes. 17.1.8 crcprs function a cyclic redundancy check/pseudo random sequence (crcprs) function consists of a polynomial register, a lin- ear feedback shift register (lfsr), and a seed register. when the crcprs block is disabled and a seed value is written into dr2, the seed value is also loaded into dr0. when the crcprs is enabled, and synchronous clock and data are applied to the inputs, a crc is computed on the serial data input stream. when the data input is forced to '0', then the block functions as a prs generator with the output data generated at the clock rate. the most significant bit (msb) of the crcprs function is the primary output. the crcprs has a selection of compare modes between dr0 and dr2. the default behavior of the compare is dr0==dr2. when the prs function cycles through the seed value as one of the valid counts, the compare output is asserted high for one clock cycle. this is regarded as the epoch of the pseudo random sequence. the mode bits can be used to set other compare types. setting mode bit 0 to '1' causes the compare behavior to revert to dr0 <= dr2 or dr0 < dr2, depending upon mode bit 1. the compare value is the auxiliary output and the interrupt. crcprs mode offers an optional pass function. by setting the pass mode bit in the cr0 register (bit 1), the crcprs function is overridden. in this mode, the data input is passed transparently to the primary output and interrupt output. similarly, the clk input is passed transparently to the auxil- iary output. figure 17-4. crcprs lfsr structure lsfr structure the lsfr (linear feedback shift register) structure, as shown in figure 17-4 , is implemented as a modular shift register generator. the least significant block in the chain inputs the msb and xors it with the data input, in the case of crc computation. for prs computation, the data input is forced to logic '0' (by input selection) and therefore, the msb bus is directly connected to the fb bus. in the case of a chained block, the data input (din) comes directly from the data output (do) of the lfsr in the previous block. the msb selection, derived from the priority decode of the poly- nomial, enables one of the tri-state drivers to drive the msb bus. determining the crc polynomial computation of an n-bit result is generally specified by a polynomial with n+1 terms, the last of which is x 16 , where equation 1 as an example, the crc-ccit 16-bit polynomial is: equation 2 the crcprs hardware assumes the presence of the x 0 term and therefore, this polynomial can be expressed in 16- bits as 1000100000010000 or 8810h. two consecutive digi- tal blocks may be allocated to perform this function, with 88h do 012 7 6 fb tri-state bus data msb tri-state bus poly[0] poly[1] poly[6] poly[7] 2:1 din (from previous block do, if chained.) (data input for crc, if prs, force to logic ?0?.) (to next block, if chained.) msb sel is determined by a priority decode of the msb, of the polynomial across all blocks of a crcprs function. msb sel x 0 1 = crc ccit ? x 16 x 12 x 5 1 +++ =
december 22, 2003 document no. 38-12009 rev. *d 195 cy8c22xxx preliminary data sheet 17. digital blocks as the ms block polynomial (dr1) and 10h as the ls block polynomial value. determining the prs polynomial generally, prs (pseudo random sequence) polynomials are selected from pre-computed reference tables. it is important to note that there are two common ways to specify a prs polynomial: simple register configuration and modular con- figuration. in the simple method, a shift register is imple- mented with a reduction xor of the msb and feedback taps as input into the least significant bit. in the modular method, there is an xor operation implemented between each reg- ister bit and each tap point enables the xor with the msb for that given bit. the crcprs function implements the modular approach. converting a polynomial spec to a modular spec these are equivalent methods. however, there is a conver- sion that should be understood. if tables are specified in simple register format, then a conversion can be made to the modular format by subtracting each tap from the ms tap as shown in the following example. to implement a 7-bit prs of length 127, one possible code is [7,6,4,2]s, which is in simple format. the modular format would be [7,7-2,7-4,7-6]m or [7,5,3,2]m. determining the polynomial to program is similar to the crc example above. set a binary bit for each tap (with bit 0 of the register corre- sponding to tap 1). therefore, the code [7,5,3,2] would cor- respond to 01010110 or 56h. in both the crc and prs cases, an appropriate seed value should be selected that is greater than or equal in bit length. 17.1.8.1 usability exceptions the following are usability exceptions for the crcprs func- tion. 1. the polynomial register must only be written when the block is disabled. 17.1.8.2 block interrupt the crcprs has one fixed interrupt source, which is the compare auxiliary output. 17.1.9 spi protocol function the serial peripheral interface (spi) is a motorola specifica- tion for implementing full-duplex synchronous serial commu- nication between devices. the 3-wire protocol uses both edges of the clock to enable synchronous communication, without the need for stringent setup and hold requirements. figure 17-5. basic spi configuration a device can be a master or slave. a master outputs clock and data to the slave device and inputs slave data. a slave device inputs clock and data from the master device and outputs data for input to the master. the master and slave together are essentially a circular shift register, where the master is generating the clocking and initiating data trans- fers. a basic data transfer occurs when the master sends 8 bits of data, along with eight clocks. in any transfer, both master and slave are transmitting and receiving simultaneously. if the master is only sending data, the received data from the slave is ignored. if the master wishes to receive data from the slave, the master must send dummy bytes to generate the clocking for the slave to send data back. 17.1.9.1 spi protocol register definitions the spi protocol register definitions are located in table 17- 4 . the use of the ss_ signal varies according to the capabil- ity of the slave device. spi master spi slave mosi sclk ss_ miso mosi miso sclk data is output by both the master and slave, on one edge of the clock. data is registered at the input of both devices, on the opposite edge of the clock. mosi sclk ss_ miso table 17-4. spi protocol register descriptions name function description mosi master out slave in master data output. miso master in slave out slave data output. sclk serial clock clock generated by the master. ss_ slave select (active low) this signal is provided to enable multi-slave connections to the miso pin. the mosi and sclk pins can be connected to multiple slaves, and the ss_ input selects which slave will receive the input data and drive the miso line.
17. digital blocks cy8c22xxx preliminary data sheet 196 document no. 38-12009 rev. *d december 22, 2003 17.1.10 spi master function the spi master (spim) offers spi operating modes 0-3. by default, the msb of the data byte is shifted out first. an addi- tional option can be set to reverse the direction and shift the data byte out lsb first. when configured for spim, dr0 functions as a shift register, with input from the data input (miso) and output to the pri- mary output f1 (mosi). dr1 is the tx buffer register and dr2 is the rx buffer register. the spi protocol requires data to be registered at the device input, on the opposite edge of the clock that operates the output shifter. an additional register (rxd), at the input to the dr0 shift register, has been implemented for this pur- pose. this register stores received data for one-half cycle, before it is clocked into the shift register. the spim controls data transmission between master and slave because it generates the bit clock for internal clocking and for clocking the spis. the bit clock is derived from the clk input selection. since the psoc system clock genera- tors produce clocks with varying duty cycles, the spim divides the input clk by two to produce a bit clock with a fifty percent duty cycle. this clock is gated, to provide the sclk output on the auxiliary output, during byte transmis- sions. there are four control bits and four status bits in the control register that provide for host interfacing and synchroniza- tion. the spim hardware has no support for driving the slave select (ss_) signal. the behavior and use of this signal is application and chip dependent and, if required, must be implemented in firmware. this spim function may not be chained. 17.1.10.1 block interrupt the spim block has a selection of two interrupt sources: interrupt on tx reg empty (default), or interrupt on spi complete. mode bit 1 in the function register controls the selection. if spi complete is selected as the block interrupt, the con- trol register must be read in the interrupt routine so that this status bit is cleared; otherwise, no subsequent interrupts are generated. 17.1.11 spi slave function the spi slave (spis) offers spi operating modes 0-3. by default, the msb of the data byte is shifted out first. an addi- tional option can be set to reverse the direction and shift the data byte out lsb first. when configured for spi, dr0 functions as a shift register, with input from the data input (mosi) and output to the pri- mary output f1 (miso). dr1 is the tx buffer register and dr2 is the rx buffer register. the spi protocol requires data to be registered at the device input, on the opposite edge of the clock that operates the output shifter. an additional register (rxd), at the input to the dr0 shift register, has been implemented for this pur- pose. this register stores received data for one-half cycle before it is clocked into the shift register. the spis function derives all clocking from the sclk input (typically an external spi master). this means that the mas- ter must initiate all transmissions. for example, to read a byte from the spis, the master must send a byte. since there are no internal clocks used in the spis, it may be clocked asynchronously (if input synchronization is turned off). in this case, synchronization between the cpu and the spis block can be accomplished with polling and/or interrupts. there are four control bits and four status bits in the control register that provide for host interfacing and synchroniza- tion. in the spis, there is an additional data input, slave select (ss_), which is an active low signal. ss_ must be asserted to enable the spis to receive and transmit. ss_ has two high-level functions: 1) to allow for the selection of a given slave in multi-slave environment, and 2) to provide addi- tional clocking for tx data queuing in spi modes 0 and 1. ss_ may be controlled from an external pin, through a row input. when ss_ is negated, the spis ignores any mosi/sclk input from the master. in addition, the spis state machine is reset, and the miso output is forced to idle at logic '1'. this allows for a wired-and connection in a multi-slave environ- ment. note that if hi-z output is required when the slave is not selected, this behavior must be implemented in firmware with io writes to the port drive register. 17.1.11.1 usability exceptions the following are usability exceptions for the spi slave function. 1. the ss_ input must be synchronized, but the mosi and sclk inputs may be synchronized or not. unsynchro- nized data and clock inputs reduce the latency through the block and thus allow an spi system to run at a slightly higher clock rate. 17.1.11.2 block interrupt the spis block has a selection of two interrupt sources: interrupt on tx reg empty (default) or interrupt on spi complete (same selection as the spim). mode bit 1 in the function register controls the selection. if spi complete is selected as the block interrupt, the con- trol register must still be read in the interrupt routine so that this status bit is cleared; otherwise, no subsequent inter- rupts are generated.
december 22, 2003 document no. 38-12009 rev. *d 197 cy8c22xxx preliminary data sheet 17. digital blocks 17.1.12 asynchronous transmitter function in the transmitter function, dr0 functions as a shift register, with no input and with the txd serial data stream output to the primary output f1. dr1 is a tx buffer register and dr2 is unused in this configuration. unlike spi, which has no output latency, the txd output has one cycle of latency. this is because a multiplexer at the output must select which bits to shift out: the shift register data, framing bits, parity, or mark bits. the output of this mul- tiplexer is registered to unglitch it. when the block is first enabled or when it is idle, a mark bit (logic '1') is output. the clock generator is a free running divide by eight circuit. although dividing the clock is not necessary for the trans- mitter function, the receiver function does require a divide by eight for input sampling. it is also done in the transmitter function, to allow the tx and rx functions to run off the same baud rate generator. there are two formats supported: a 10-bit frame size includ- ing one start bit, eight data bits, and one stop bit or an 11-bit frame size including one start bit, eight data bits, one parity bit, and one stop bit. the parity generator can be configured to output either even or odd parity on the eight data bits. a write to the tx buffer register (dr1) initiates a transmis- sion and an additional byte can be buffered in this register, while transmission is in progress. an additional feature of the transmitter function is that a clock, generated with setup and hold time for the data bits only, is output to the auxiliary output. this allows connection to a crc generator or other digital blocks. the transmitter function may not be chained. 17.1.12.1 block interrupt the transmit block has a selection of two interrupt sources. interrupt on tx reg empty (default) or interrupt on tx com- plete. mode bit 1 in the function register controls the selec- tion. if tx complete is selected as the block interrupt, the control register must still be read in the interrupt routine so that this status bit is cleared; otherwise, no subsequent interrupts are generated. 17.1.13 asynchronous receiver function in the receiver function, dr0 functions as the serial data shift register with rxd input from the data input selection. dr2 is an rx buffer register and dr1 is unused in this con- figuration. the clock generator and start detection are integrated. the clock generator is a divide by eight which, when the system is idle, is held in reset. when a start bit (logic '0') is detected on the rxd input, the reset is negated and a bit rate clock is generated, subsequently sampling the rxd input at the center of the bit time. every succeeding start bit resynchronizes the clock generator to the incoming bit rate. there are two formats supported: a 10-bit frame size includ- ing one start bit, eight data bits, and one stop bit. or an 11-bit frame size including one start bit, eight data bits, one parity bit, and one stop bit. the received data is an input to the parity generator. it is to be compared with a received parity bit, if this feature is enabled. the parity generator can be configured to output either even or odd parity on the eight data bits. after eight bits of data are received, the byte is transferred from the dr0 shifter to the dr2 rx buffer register. an additional feature of the receiver function is that input data (rxd) and the synchronized clock are passed to the primary output and auxiliary output, respectively. this allows connection to a crc generator or other digital block. 17.1.13.1 block interrupt the receiver has one fixed interrupt source, which is the rx reg full status. the rx buffer register must always be read in the rx inter- rupt routine, regardless of error status, etc., so that rx reg full status bit is cleared; otherwise, no subsequent inter- rupts are generated.
17. digital blocks cy8c22xxx preliminary data sheet 198 document no. 38-12009 rev. *d december 22, 2003 17.2 register definitions the digital block registers in this chapter are organized by function, as presented in table 17-5 . to reference timing diagrams associated with the digital block registers, see ?timing diagrams? on page 204 . for a complete list of the digital block registers showing their addresses and bit names, reference the ?digital register summary? on page 176 . data and control registers 17.2.1 dxbxxdrx registers the data and control registers presented in this section encompass the dxbxxdr0, dxbxxdr1, and dxbxxdr2 registers. they are discussed according to which bank they are located in and then detailed in tables by function type. there are two banks of registers associated with the psoc device. bank 0 encompasses the user registers for the device and bank 1 encompasses the configuration registers for the device. both are defined below. reference the ?bank 0 registers? on page 86 and the ?bank 1 registers? on page 145 for more information. for additional information, reference the register details chapter for the following registers: dxbxxdr0 register on page 90 . dxbxxdr1 register on page 91 . dxbxxdr2 register on page 92 . 17.2.1.1 timer register definitions table 17-5. digital block register definitions dr0 dr1 dr2 cr0 function access function access function access function access timer down counter r* period w capture/compare rw control rw counter down counter r* period w compare rw control rw dead band down counter r* period w n/a n/a control rw crcprs lfsr r* polynomial w seed rw control rw spim shifter n/a tx buffer w rx buffer r control/status rw** spis shifter n/a tx buffer w rx buffer r control/status rw** txuart shifter n/a tx buffer w n/a n/a control/status rw** rxuart shifter n/a n/a n/a rx buffer r control/status rw** legend * in timer, counter, dead band, and crcprs functions, a read of the dr0 register returns 00h and transfers dr0 to dr2. ** in the communications functions, control bits are read-write access and status bits are read-only access. bank 0: there are three 8-bit data registers and a 3-bit control register. ta b l e 1 7 - 6 explains the meaning of these registers in the context of timer opera- tion. bank 1: the mode bits in the function register are block type specific. other bit fields in this register, as well as the definitions o f the input and output reg- isters, are common to all functions and are described in the ?dxbxxin registers? on page 204 and the ?dxbxxou registers? on page 204 . these mode bits are independent in the timer block and control the interrupt type and the compare type. timers have a special d ivide by one mode, when the period of the dr0 register is set to 00h. in this configuration, the primary output terminal count (tc) is the i nverted input clock. the interrupt output is also the input clock inverted. table 17-6. timer data register descriptions name function description dr0 count value not directly readable or writeable. during normal operation, dr0 stores the current count of a synchronous down counter. when disabled, a write to the dr1 period register is also simultaneously loaded into dr0 from the data bus. when disabled, a read of dr0 returns 00h to the data bus and transfers the contents of dr0 to dr2. this transfer only occurs in the addressed block. when enabled, a read of dr0 returns 00h to the data bus and synchronously transfers the contents of dr0 to dr2. oper- ates simultaneously on the byte addressed and all higher bytes in a multi-block timer. note that when the hardware capture input is high, the read of dr0 (software capture) will be masked and will not occur. the hardware capture input must be low for a software capture to occur.
december 22, 2003 document no. 38-12009 rev. *d 199 cy8c22xxx preliminary data sheet 17. digital blocks 17.2.1.2 counter register definitions dr1 period write only register. data in this register sets the period of the count. the actual number of clocks counted is period + 1. in the default one-half cycle terminal count mode, a period value of 00h results in the primary output to be the inversion of the input clock. in the optional full cycle terminal count mode, a period of 00h gives a constant logic high on the primary out - put. when disabled, a write to this register also transfers the period value directly into dr0. when enabled, if the block frequency is 24 mhz or below, this register may be written to at any time, but the period will only be reloaded into dr0 in the clock following a terminal count. if the block frequency is 48 mhz, the terminal count or compare interrupt should be used to synchronize the new period register write; otherwise, the counter could be incorrectly loaded. dr2 capture/ compare read write register (see exception below). dr2 has multiple functions in a timer configuration. it is typically used as a capture register, but it also functions as a com - pare register. when enabled and a capture event occurs, the current count in dr0 is synchronously transferred into dr2. when enabled, the compare output is computed using the compare type (set in the function register mode bits) between dr0 and dr2. the result of the compare is output to the auxiliary output. when disabled, a read of dr0 will transfer the contents of dr0 into dr2 for the addressed block only. exception : when enabled, dr2 is not writeable. bank 0: there are three 8-bit data registers and a 2-bit control register. ta b l e 1 7 - 7 explains the meaning of these registers in the context of the counter operation. note that the descriptions of the registers are dependant on the enable/disable state of the block. this behavior is only related to the enable bit in the control register, not the data input that provides the counter gate (unless otherwise noted). bank 1: the mode bits in the function register are block type specific. other bit fields in this register, as well as the definitions o f the input and output reg- isters are common to all functions. these mode bits are independent in the counter block and control the interrupt type and the compare type (same as the timer function). table 17-7. counter data register descriptions name function description dr0 count value not directly readable or writeable. during normal operation, dr0 stores the current count of a synchronous down counter. when disabled, a write to the dr1 period register is also simultaneously loaded into dr0 from the data bus. when disabled or the data input (counter gate) is low, a read of dr0 returns 00h to the data bus and transfers the contents of dr0 to dr2. this register should not be read when the counter is enabled and counting. dr1 period write only register. data in this register sets the period of the count. the actual number of clocks counted is period + 1. in the default one-half cycle terminal count mode, a period value of 00h will result in the auxiliary output to be the inversio n of the input clock. in the optional full cycle terminal count mode, a period of 00h gives a constant logic high on the auxiliar y output. when disabled, a write to this register also transfers the period value directly into dr0. when enabled, if the block frequency is 24 mhz or below, this register may be written to at any time, but the period will only be reloaded into dr0 in the clock following a terminal count. if the block frequency is 48 mhz, the terminal count or compare interrupt should be used to synchronize the new period register write; otherwise, the counter could be incorrectly loaded. dr2 compare read write register. dr2 functions as a compare register. when enabled, the compare output is computed using the compare type (set in the function register mode bits) between dr0 and dr2. the result of the compare is output to the primary output. when disabled or the data input (counter gate) is low, a read of dr0 will transfer the contents of dr0 into dr2. dr2 may be written to when the function is enabled or disabled. table 17-6. timer data register descriptions (continued) name function description
17. digital blocks cy8c22xxx preliminary data sheet 200 document no. 38-12009 rev. *d december 22, 2003 17.2.1.3 dead band register definitions 17.2.1.4 crcprs register definitions bank 0: there are three 8-bit data registers and a 3-bit control register. ta b l e 1 7 - 8 explains the meaning of these registers in the context of dead band operation. bank 1: the mode bits in the function register are block type specific. other bit fields in this register, as well as the definitions o f the input and output reg- isters, are common to all functions. mode [1:0] is encoded as the kill type. in all cases, the output is forced low immediately. mode bits are encoded for kill opti ons and are detailed in the following table. reference ?dead band timing? on page 206 for additional information on the dead band kill options. table 17-8. dead band register descriptions name function description dr0 count value not directly readable or writeable. during normal operation, dr0 stores the current count of a synchronous down counter. when disabled, a write to the dr1 period register is also simultaneously loaded into dr0 from the data bus. when disabled, a read of dr0 returns 00h to the data bus and transfers the contents of dr0 to dr2. dr1 period write only register. data in this register sets the period of the dead band count. the actual number of clocks counted is period + 1. the mini- mum period value is 00h, which sets a dead band time of one clock. when disabled, a write to this register also transfers the period value directly into dr0. when enabled, if the block frequency is 24 mhz or below, this register may be written to at any time, but the period will only be reloaded into dr0 in the clock following a terminal count. if the block frequency is 48 mhz, the terminal count or compare interrupt should be used to synchronize the new period register write; otherwise, the counter could be incorrectly loaded. dr2 buffer when disabled, a read of dr0 will transfer the contents of dr0 into dr2. bank 0: there are three data registers and one control register. ta b l e 1 7 - 9 explains the meaning of these registers in the context of crcprs operation. note that in the crcprs function, a write to the dr2 seed register is also loaded simultaneously into dr0. bank 1: the mode bits in the function register are block type specific. other bit fields in this register, as well as the definitions o f the input and output reg- isters, are common to all functions and are described in the ?dxbxxin registers? on page 204 and the ?dxbxxou registers? on page 204 . the mode bits are encoded to determine the compare type. table 17-9. crcprs register descriptions name function description dr0 lfsr not directly readable or writeable. during normal operation, dr0 stores the state of a synchronous linear feedback shift register. when disabled, a write to the dr2 seed register is also simultaneously loaded into dr0 from the data bus. when disabled, a read of dr0 returns 00h to the data bus and transfers the contents of dr0 to dr2. this register should not be read while the block is enabled. dr1 polynomial write only register. data in this register sets the polynomial for the crc or prs function. exception : this register must only be written when the block is disabled. dr2 seed/residue read write register. dr2 functions as a seed and residue register. when disabled, a write to this register also transfers the seed value directly into dr0. when enabled, dr2 may be written to at any time. value written will be used in the compare function. when enabled, the compare output is computed using the compare type (set in the function register mode bits) between dr0 and dr2. the result of the compare is output to the auxiliary output. when disabled, a read of dr0 will transfer the contents of dr0 into dr2. this feature can be used to read out the residue, after a crc operation is complete.
december 22, 2003 document no. 38-12009 rev. *d 201 cy8c22xxx preliminary data sheet 17. digital blocks 17.2.1.5 spi master register definitions 17.2.1.6 spi slave register definitions bank 0: there are three 8-bit data registers and one 8-bit control/status register. the following tables explain the meaning of these r egisters in the context of spim operation. bank 1: mode bit 1 in the function register is block type specific and selects interrupt type. mode bit 0 selects master or slave (for spim, it is '0'). other bit fields in this register, as well as the definitions of the input and output registers, are common to all functions. table 17-10. spim data register descriptions name function description dr0 shifter not readable or writeable. during normal operation, dr0 implements a shift register for shifting serial data. dr1 tx buffer write only register. if no transmission is in progress and this register is written to, the data from this register (dr1) is loaded into the shift r egister (dr0), on the following clock edge, and a transmission is initiated. if a transmission is currently in progress, this regist er serves as a buffer for tx data. this register should only be written to when tx reg empty status is set, and this write clears the tx reg empty status bit in the control register. when the data is transferred from this register (dr1) to the shift register (dr0), then tx reg empty sta- tus is set. dr2 rx buffer read only register. when a byte transmission/reception is complete, the data in the shifter (dr0) is transferred into the rx buffer register and rx reg full status in the control register is set. a read from this register (dr2) clears the rx reg full status bit in the control register. bank 0: there are three 8-bit data registers and one 8-bit control/status register. figure 17-11 explains the meaning of these registers in the context of spis operation. bank 1: mode bit 1 in the function register is block type specific and selects interrupt type. mode bit 0 selects master or slave (for spis, it is '1'). the spis has block-specific bits in the output register, to select and control the slave select (ss_) input and behavior. other input and output register bit field definitions are common to all functions and are described in ?dxbxxin registers? on page 204 and ?dxbxxou registers? on page 204 . the spis is unique in that it has three function inputs and one function output defined. when the aux io enable bit is '0', the aux io select bits are used to select one of four inputs from the auxiliary data input multiplexer to drive the ss_ input. alternatively, when the aux io enable bit is a '1', the ss_ signal is driven directly from the value of the aux io select[0] bit. thus, the ss_ input can be controlled in fir mware, eliminating the need to use an additional gpio pin for this purpose. regardless of how the ss_ bit is configured, a spis block has the auxiliary row output drivers forced off and therefore, the au xiliary output is not available in this block. table 17-11. spis data register descriptions name function description dr0 shifter not readable or writeable. during normal operation, dr0 implements a shift register for shifting serial data. dr1 tx buffer write only register. this register should only be written to when tx reg empty status is set and the write clears the tx reg empty status bit in the control register. when the data is transferred from this register (dr1) to the shift register (dr0), then tx reg empty sta- tus is set. dr2 rx buffer read only register. when a byte transmission/reception is complete, the data in the shifter (dr0) is transferred into the rx buffer register and rx reg full status in the control (cr0) register is set. a read from this register (dr2) clears the rx reg full status bit in the control register.
17. digital blocks cy8c22xxx preliminary data sheet 202 document no. 38-12009 rev. *d december 22, 2003 17.2.1.7 transmitter register definitions 17.2.1.8 receiver register definitions bank 0: there are three 8-bit data registers and one 5-bit control/status register. figure 17-12 explains the meaning of these registers in the context of transmitter operation. bank 1: the mode bits in the function register are block type specific. other input and output registers bit field definitions are comm on to all functions. in the function register, the mode bit 0 selects between transmitter and receiver (in this case mode bit 0 is set to 1 for tx) and the mode bit 1 selects the interrupt type. table 17-12. transmitter data register descriptions name function description dr0 shifter not readable or writeable. during normal operation, dr0 implements a shift register for shifting out serial data. dr1 tx buffer write only register. if no transmission is in progress and this register is written to, subject to the setup time requirement, the data from this re gis- ter (dr1) is loaded into the shift register (dr0) on the following clock edge and a transmission is initiated. if a transmis sion is currently in progress, this register serves as a buffer for tx data. this register should only be written to when tx reg empty status is set and this write clears the tx reg empty status bit in the control (cr0) register. when the data is transferred from this register (dr1) to the shift register (dr0), then tx reg empty status is set. dr2 na not used in this function. bank 0: there are three 8-bit data registers and one 8-bit control/status register. the following table explains the meaning of these r egisters in the context of receiver operation. bank 1: the mode bits in the function register are block type specific. other input and output registers bit field definitions are comm on to all functions. in the function register, the mode bit 0 selects between transmitter and receiver (in this case mode bit 0 is set to 0 for rx) and the mode bit 1 selects the interrupt type. table 17-13. receiver data register descriptions name function description dr0 shifter not readable or writeable. during normal operation, dr0 implements a shift register for shifting in serial data from the rxd input. dr1 na not used in this function. dr2 rx buffer read only register. after eight bits of data are received, the contents of the shifter (dr0) is transferred into the rx buffer register and the rx reg full status is set. the rx reg full status bit in the control register is cleared when this register is read.
december 22, 2003 document no. 38-12009 rev. *d 203 cy8c22xxx preliminary data sheet 17. digital blocks 17.2.2 dxbxxcr0 register the dxbxxcr0 register is the digital blocks? control register. it is described by function in table 17-14 . for additional informa- tion, reference the dxbxxcr0 register on page 93 . interrupt mask register 17.2.3 int_msk1 register the int_msk1 register is described in the ?interrupt con- troller? chapter on page 51 . for additional information, refer- ence the int_msk1 register on page 135 . configuration registers the configuration block contains 3 registers: function (dxbxxfn), input (dxbxxin), and output (dxbxxou). the values in these registers should not be changed while the block is enabled. 17.2.4 dxbxxfn registers these registers contain the primary function and mode bits. the function bits configure the block into one of the avail- able block functions (six for the comm block, four for the basic block). the mode bits select the options available for the selected function. these bits should only be changed when the block is disabled. three additional control bits are found in this register. the end/single bit is used to indicate the last or most significant block in a chainable function. this bit must also be set if the chainable function only consists of a single block. the data invert bit optimally inverts the selected data input. the bcen bits enable the primary output of the block, to drive the row broadcast block. the bcen bits are set inde- pendently in each block and therefore, care must be taken to ensure that only one bcen bit in a given row is enabled. however, if any of the blocks in a given row have the bcen bit set, the input that allows the broadcast net from other rows to drive the given row?s broadcast net is disabled (see figure 16-2 on page 185 ). for additional information, reference the dxbxxfn register on page 149 . table 17-14. dxbxxcr0 register description function description timer there are three bits in the control (cr0) register: one for enabling the block, one for setting the optional interrupt on captu re, and one to select between one-half and a full clock for terminal count output. counter one bit enable only. dead band there are three bits in the control (cr0) register: one bit for enabling the block, and two bits to enable and control dead ban d bit bang mode. when bit bang mode is enabled, the output of this register is substituted for the pwm reference. this register may be toggled b y user firm- ware, to generate phi1 and phi2 output clock with the programmed dead time. the options for bit bang mode are as follows: 0 function uses the previous clock primary output as the input reference. 1 function uses the bit bang clock register as the input reference. crcprs two bits are used to enable operation. spim the spi control (cr0) register contains both control and status bits. there are four control bits that are read/write: enable, clock phase and clock polarity to set the mode, and lsb first, which controls bit ordering. there are two read-only status bits: overrun and sp i complete. there are two additional read-only status bits to indicate tx and rx buffer status. spis the spi control (cr0) register contains both control and status bits. there are four control bits that are read/write: enable, clock phase and clock polarity to set the mode, and lsb first, which controls bit ordering. there are two read-only status bits: overrun and sp i complete. there are two additional read-only status bits to indicate tx and rx buffer status. txuart the transmitter control (cr0) register contains three control bits and two status bits. the control bits are enable, parity ena ble, and parity type, and have read/write access. the status bits, tx reg empty and tx complete, are read-only. rxuart the receiver control (cr0) register contains both control and status bits. three control bits are read/write: enable, parity en able, and parity type. there are five read-only status bits: rx reg full, rx active, framing error, overrun, and parity error. table 17-15. dxbxxfn function registers [2:0]: function 000b: timer 001b: counter 010b: crcprs 011b: reserved 100b: dead band for pwm 101b: uart 110b: spi 111b: reserved [4:3]: mode function specific [5]: end/single 1 == block is not chained or is at the end of a chain 0 == block is at the start of or in the middle of a chain [6]: bcen 1 == disable 0 == enable [7]: data invert 1 == invert block?s data input 0 == do not invert block?s data input
17. digital blocks cy8c22xxx preliminary data sheet 204 document no. 38-12009 rev. *d december 22, 2003 17.2.5 dxbxxin registers the input registers are 8 bits and consist of two 4-bit fields to control each of the 16-1 clock and data input multiplex- ers. the meaning of these fields depends on the external clock and data connections, which is context specific. * the dead band reference input does not use the auxiliary input multiplexer. it is hardwired to be the primary output of the previous block. ** for crc computation, the input data is a serial data stream synchronized to the clock. for prs mode, this input should be forced to logic ?0?. for additional information, reference the dxbxxin register on page 151 . 17.2.6 dxbxxou registers the output registers contains two 3-bit fields: two bits to select and one bit to enable the tri-state drivers for the pri- mary and auxiliary outputs, to drive onto the row output bus. in one case, that of the spi slave, the meaning of the auxil- iary io select bits is different. the spi slave function is unique in that it has three function inputs and one function output defined. in this configuration, the auxiliary row output drivers are disabled and the bits are used to select one of four inputs from the auxiliary data input multiplexer (normally connected to row inputs), which is used as the ss_ (slave select) signal. the aux io enable bit also has a different meaning in spi slave mode. if set, the ss_ signal is inter- nally forced active and therefore, driving the ss_ from an auxiliary data input would not be required. the output register also contains the clock synchronization bits. these two bits are used to enable the synchronization, and select between sysclk and sysclkx2. when enabled, the input clock is resynchronized to the selected system clock, which occurs after the 16-1 multiplexing. this minimizes clock skew incurred in the generation of clocks, which can be derived from a wide variety of sources and paths. under normal circumstances, synchronization should be enabled. care should be taken to resynchronize sysclkx2 clock sources to the sysclkx2 system clock. the resynchronization should only be disabled in cases where asynchronous external inputs are used, such as in spi slave configurations. * the uart blocks generate an spi mode 3 style clock that is only active dur- ing the data bits of a received or transmitted byte. ** in the spis, the field that is used to select the auxiliary output is used to control the auxiliary input to select the ss_. for additional information, reference the dxbxxou register on page 152 . 17.3 timing diagrams the timing diagrams in this section are presented according to their functionality and are in the following order. ?timer timing? on page 205 ?counter timing? on page 206 ?dead band timing? on page 206 ?crcprs timing? on page 208 ?spi mode timing? on page 208 ?spim timing? on page 209 ?spis timing? on page 212 ?transmitter timing? on page 215 ?receiver timing? on page 216 table 17-16. digital block input definitions inputs data clk auxiliary timer capture clk n/a counter enable clk n/a dead band kill clk reference * crcprs serial data ** clk n/a spim miso clk n/a spis mosi sclk ss_ transmitter n/a 8x baud clk n/a receiver rxd 8x baud clk n/a table 17-17. digital block output definitions outputs primary auxiliary interrupt timer te r m in a l c o u n t compare te r m i n a l c o u n t o r compare counter compare terminal count te r m i n a l c o u n t o r compare dead band phase 1 phase 2 phase 1 crcprs msb compare compare spim mosi sclk tx reg empty or spi complete spis miso n/a ** tx reg empty or spi complete transmitter txd sclk * tx reg empty or tx compete receiver rxd sclk * rx reg full
december 22, 2003 document no. 38-12009 rev. *d 205 cy8c22xxx preliminary data sheet 17. digital blocks 17.3.1 timer timing enable/disable operation. when the block is disabled, the clock is immediately gated low. all outputs are gated low, including the interrupt output. all internal state is reset to its configuration specific reset state, except for dr0, dr1, and dr2, which are unaffected. terminal count/compare operation. in the clock cycle following the count of 00h, the terminal count (tc) output is asserted. it is one-half cycle or a full cycle depending on the tc pulse width mode, as set in the block control register. if this block is standalone, or if it is the least significant block in a chain, the carry out (co) signal is also asserted. if the period is set to 00h, and the tc pulse width mode is one- half cycle, the output is the inversion of the input clock. the compare (cmp) output will be asserted in the cycle follow- ing the compare true, and will be negated one cycle after compare false. multi-block terminal count/compare operation. when timers are chained, the co signal of a given block becomes the ci of the next most significant block in the chain. in a chained timer, the co output indicates that block and all lower blocks are at 00h count. the co is setup to the next positive edge of the clock to enable the next higher block to count once for every terminal count of all lower blocks. the tco of a given block becomes the tci of the next least significant block in the chain. the tco output indicates that that block and all higher blocks are at 00h count. the tci/ tco chaining signals provide a way for the lower blocks to know when the upper blocks are at terminal count. reload occurs when all blocks are at terminal count, which can be determined by ci, tci and the block zero detect. example timing for a three block timer is shown in figure 17-6 . the compare circuit compares registers dr0 <= dr2. (when mode[1] = 1, the comparison is dr0 < dr2). each block has an internal compare condition (dr0 com- pared to dr2), a chaining signal to the next block called cmpo, and the chaining signal from the previous block called cmpi in any given block of a timer, the cmpo is used to generate the auxiliary output (primary output in the counter) with a 1 cycle clock delay. cmpo is generated from a combination of the internal com- pare condition and the cmpi input by the following rules: 1. for any given block, if dr0 < dr2, the cmpo condition is unconditionally asserted. 2. for any given block, if dr0 == dr2, cmpo is asserted only if the cmpi input to that block is asserted. 3. if the block is a start block, the effective cmpi depends on the compare type. if it is dr0 <= dr2, the effective cmpi input is '1'. if it is dr0 < dr2, the effective input is '0'. capture operation. in the timer implementation, a rising edge of the data input or a cpu read of dr0 triggers a syn- chronous capture event. the result of this is to generate a latch enable to dr2 that loads the current count from dr0 into dr2. the latch enable signal is synchronized in such a way that it is not closing near an edge on which the count is changing. a limitation is that capture will not work with the block clock of 48 mhz. (a fundamental limitation to timer capture opera- tion is the fact the gpio inputs are currently synchronized to the 24 mhz system clock). figure 17-6. multi-block timing clk 2 1 0 ff fe count lsb example of multi-block timer counting msb period = k, isb period = m, lsb period = n carry out lsb count isb 1 carry out isb 0 210nn-1 0 m 0 count msb zero detect lsb zero detect isb k zero detect msb carry out msb multi-block tc reload occurs when all blocks reach terminal count.
17. digital blocks cy8c22xxx preliminary data sheet 206 document no. 38-12009 rev. *d december 22, 2003 17.3.2 counter timing enable/disable operation. see timer enable/disable operation ( ?timer function? on page 192 ). terminal count/compare operation. see timer terminal count/compare operation ( ?timer function? on page 192 ). multi-block operation. see timer multi-block terminal count/compare operation ( ?timer function? on page 192 ). gate (enable) operation. the data input controls the counter enable. the transition on this enable must have at least one 24 mhz cycle of setup time to the block clock. this will be ensured if internal or synchronized external inputs are used. for external unsynchronized signals, the user is responsible for this setup time. as shown in figure 17-7 , when the data input is negated (counting is disabled) and the count is 00h, the tc output stays low until the clock following the assertion of the data input. when the block is disabled, the clock is immediately gated low. all internal state is reset, except for dr0, dr1, and dr2, which are unaffected. figure 17-7. counter terminal count timing with gate disable 17.3.3 dead band timing enable/disable operation. initially both outputs are low. there are no critical timing requirements for enabling the block because dead band processing does not start until the first incoming positive or negative reference edge. in typical operation, it is recommended that the dead band block be enabled first, then the pwm generator block. when the block is disabled, the clock is immediately gated low. all outputs are gated low, including the interrupt output. all internal state is reset to its configuration specific reset state, except for dr0, dr1, and dr2, which are unaffected. normal operation. figure 17-8 shows typical dead band timing. the incoming reference edge can occur up to one 24 mhz system clock before the edge of the block clock. on the edge of the block clock, the currently asserted output is negated and the dead band counter is enabled. after period + 1 clocks, the phase associated with the current state of the pwm reference is asserted (reference high = phase 1, reference low = phase 2). the minimum dead time occurs with a period value of 00h, and that dead time is one clock cycle. figure 17-8. basic dead band timing clk data (gate) count tc n-1 n 1 20 clock pwm reference phi2 (auxiliary output) dead time phi1 (primary output) dead time in clocks is the period + 1. a pwm reference edge running on the same clock occurs here. a bit bang clock can occur anywhere up to one 24 mhz clock before the next block clock edge. a high on the reference asserts ph1, a low phi2. count p-1 p-2 1 0 p p
december 22, 2003 document no. 38-12009 rev. *d 207 cy8c22xxx preliminary data sheet 17. digital blocks 17.3.3.1 changing the pwm duty cycle under normal circumstances, the dead band period is less than the minimum pwm high or low time. as an example, consider the following diagram where the low of the pwm is 4 clocks and the dead band period is 2 clocks and the high time of the phi2 is 2 clocks. figure 17-9. db high time is pwm width minus db period in figure 17-10 , you reduce the width of the pwm low time by 1 clock (to 3 clocks). the dead band period remains the same, but the high time for phi2 is reduced by 1 clock (to 1 clock). of course the opposite phase, phi1, increases in length by 1 clock. figure 17-10. db high time is reduced as pwm width is reduced if the width of the pwm low time is reduced to a point where it is equal to the dead band period, the corresponding phase, phi2, disappears altogether. note that after the ris- ing edge of the pwm the opposite phase still has the pro- grammed dead band. figure 17-11 shows an example where the dead band period is 2 and the pwm width is 2. in this case, the high time of phi2 is 0 clocks. note that the phase 1 dead band time is still 2 clocks. figure 17-11. pwm width equal to dead band period in the case where the dead band period is greater than the high or low of the pwm reference, the output of the associ- ated phase will not be asserted high. 17.3.3.2 kill operation it is assumed that the kill input will not be synchronized at the row input. (this is not a requirement; however, if syn- chronized the kill operation will have up to two 24 mhz clock cycles latency, which is undesirable.) to support the restart modes, the negation of kill is internally (in the block) synchronized to the 24 mhz system clock. there are three kill modes supported. in all cases, the kill signal asynchronously forces the outputs to logic '0'. the differences in the modes come from how dead band processing is restarted. 1. synchronous restart mode : when kill is asserted high internal state is held in reset and the initial dead band period is reloaded into the counter. while kill is held high, incoming pwm reference edges are ignored. when kill is negated, the next incoming pwm refer- ence edge restarts dead band processing. see figure 17-12 . 2. asynchronous restart mode : when kill is asserted high, internal state is not affected. when kill is negated, outputs are restored, subject to a minimum dis- able time between one-half and one and one-half clock cycle. see figure 17-13 . 3. disable mode : there is no specific timing associated with disable mode. the block is disabled and the user must re-enable the function in firmware to continue pro- cessing. figure 17-12. synchronous restart kill mode clk pwm phi1 phi2 2 2 2 4 clk wm phi1 phi2 2 2 1 3 clk pwm phi1 phi2 2 2 2 pwm reference phi2 phi1 kill short kill, outputs off for remainder of current cycle. operation resumes on the next pwm edge. pwm reference phi2 phi1 kill output is off for duration of kill on time. these edges are skipped. operation resumes on this edge.
17. digital blocks cy8c22xxx preliminary data sheet 208 document no. 38-12009 rev. *d december 22, 2003 figure 17-13. asynchronous restart kill mode 17.3.4 crcprs timing enable/disable operation. same as timer enable/dis- able operation ( ?timer timing? on page 205 ) when the block is disabled, the clock is immediately gated low. all outputs are gated low, including the interrupt output. all internal state is reset to its configuration specific reset state, except for dr0, dr1, and dr2, which are unaffected. 17.3.5 spi mode timing figure 17-14 shows the spi modes, which are typically defined as 0, 1, 2, or 3. these mode numbers are an encod- ing of two control bits, clock phase and clock polarity. clock phase indicates the relationship of the clock to the data. when the clock phase is '0', it means that the data is registered as an input on the leading edge of the clock and the next data is output on the trailing edge of the clock. when the clock phase is '1', it means that the next data is output on the leading edge of the clock, and that data is reg- istered as an input on the trailing edge of the clock. clock polarity controls clock inversion. when clock polarity is set to '1`, the clock idle state is high. figure 17-14. spi mode timing pwm reference phi2 phi1 kill outputs are forced low only as long as the kill is asserted, subject to the minimum disable time. internal operation is unaffected. pwm reference phi2 phi1 kill outputs are disabled immediately on kill. minimum disable time is between ? and 1? block clock cycle. phi1 or phi2 kill block clk example of kill shorter than the minimum. example of kill longer than the minimum. mode 2,3 (phase=1) output on leading edge. input on trailing edge. sclk,polarity=0 (mode 2) mosi miso sclk, polarity=1 (mode 3) 765 43210 mode 0,1 (phase=0) input on leading edge. output on trailing edge. sclk,polarity=0 (mode 0) mosi miso sclk, polarity=1 (mode 1) 765 43210 ss_ ss_
december 22, 2003 document no. 38-12009 rev. *d 209 cy8c22xxx preliminary data sheet 17. digital blocks 17.3.6 spim timing enable/disable operation. as soon as the block is config- ured for spim, the primary output is the msb or lsb of the shift register, depending on the lsbf configuration in bit 7 of the control register. the auxiliary output is '1' or '0' depend- ing on the idle clock state of the spi mode. this is the idle state. when the spim is enabled, the internal reset is released on the divide by 2 flip-flop, and on the next positive edge of the selected input clock. this 1 bit divider transitions to a '1' and remains free-running thereafter. when the block is disabled, the sclk and mosi outputs revert to their idle state. all internal state is reset (including cr0 status) to its configuration specific reset state, except for dr0, dr1, and dr2, which are unaffected. normal operation. typical timing for a spim transfer is shown in figure 17-15 and figure 17-16 . the user initially writes a byte to transmit when tx reg empty status is true.if no transmission is currently in progress, the data is loaded into the shifter and the transmission is initiated. the tx reg empty status is asserted again and the user is allowed to write the next byte to be transmitted to the tx buffer regis- ter. after the last bit is output, if tx buffer data is available with one-half clock setup time to the next clock, a new byte transmission will be initiated. a spim block receives a byte at the same time that it sends one. the spi complete or rx reg full can be used to determine when the input byte has been received. figure 17-15. typical spim timing in mode 0 and 1 internal clock tx reg empty d7 mosi d6 d5 d2 d1 d0 d7 user writes first byte to the tx buffer register. shifter is loaded with first byte. user writes next byte to the tx buffer register. sclk (mode 0) shifter is loaded with next byte. last bit of received data is valid on this edge and is latched into rx buffer. clk input free running internal bit rate clock is clk input divided by two. setup time for tx buffer write. sclk (mode 1) rx reg full first input bit is latched. first shift
17. digital blocks cy8c22xxx preliminary data sheet 210 document no. 38-12009 rev. *d december 22, 2003 figure 17-16. typical spim timing in mode 2 and 3 status generation and interrupts. there are four status bits in an spi block: tx reg empty, rx reg full, spi com- plete, and overrun. tx reg empty indicates that a new byte can be written to the tx buffer register. when the block is enabled, this status bit is immediately asserted. this status bit is cleared when the user writes a byte of data to the tx buffer register. tx reg empty is a control input to the state machine and if a transmission is not already in progress, the assertion of this control signal initiates one. this is the default spim block interrupt. however, an initial interrupt is not generated when the block is enabled. the user must write a byte to the tx buffer register and that byte must be loaded into the shifter before interrupts generated from the tx reg empty status bit are enabled. rx reg full is asserted on the edge that captures that 8th bit of receive data. this status bit is cleared when the user reads the rx buffer register (dr2). overrun status is set if rx reg full is still asserted from a previous byte when a new byte is about to be loaded into the rx buffer register. because the rx buffer register is imple- mented as a latch, overrun status is set one-half bit clock before rx reg full status. spi complete is an optional interrupt and is generated when 8 bits of data and clock have been sent. in modes 0 and 1, this occurs one-half cycle after rx reg full is set because in these modes, data is latched on the leading edge of the clock, and there is an additional one-half cycle remaining to complete that clock. in modes 2 and 3, this occurs at the same edge that the receive data is latched. this signal may be used to read the received byte or it may be used by the spim to disable the block after data transmission is com- plete. see figure 17-17 and figure 17-18 for status timing rela- tionships. internal clock tx reg empty d7 mosi d6 d5 d2 d1 d0 d7 user writes first byte to the tx buffer register. shifter is loaded with the first byte. user writes next byte to the tx buffer register. sclk (mode 2) shifter is loaded with the next byte. last bit of received data is valid on this edge and is latched into rx buffer. clk input free running internal bit rate clock is clk input divided by two. setup time for the tx buffer write. sclk (mode 3) rx reg full first input bit is latched. first shift
december 22, 2003 document no. 38-12009 rev. *d 211 cy8c22xxx preliminary data sheet 17. digital blocks figure 17-17. spi status timing for modes 0 and 1 figure 17-18. spi status timing for modes 2 and 3 sclk (mode 1) sclk (mode 0) ss forced low ss toggled on a message basis ss toggled on each byte ss transfer in progress sclk (mode 1) sclk (mode 0) ss transfer in progress transfer in progress sclk (mode 1) sclk (mode 0) ss transfer in progress transfer in progress mode 2,3 (phase=1) output on leading edge. input on trailing edge. sclk,polarity=0 (mode 2) mosi miso sclk, polarity=1 (mode 3) 765 43210 ss_ tx reg empty rx reg full spi complete overrun overrun occurs ? cycle before the last bit is received. last bit of byte is received. all clocks and data for this byte completed. tx buffer is transferred into the shifter 7 user writes the next byte. 765 43210 7 tx buffer is transferred into the shifter.
17. digital blocks cy8c22xxx preliminary data sheet 212 document no. 38-12009 rev. *d december 22, 2003 17.3.7 spis timing enable/disable operation. as soon as the block is config- ured for spi slave, and before enabling, the miso output is set to idle at logic '1'. both the enable bit must be set and the ss_ asserted (either driven externally or forced by firmware programming) for the block to output data. when enabled, the primary output is the msb or lsb of the shift register, depending on the lsbf configuration in bit 7 of the control register. the auxiliary output of the spis is always forced into tri-state. since the spis has no internal clock, it must be enabled with setup time to any external master supplying the clock. setup time is also required for a tx buffer register write, before the first edge of the clock or the first falling edge of ss_, depending on the mode. this setup time must be assured through the protocol and an understanding of the timing between the master and slave in a system. if ss_ is forced active (low) by configuration, before the block is enabled, no initial load from the tx buffer register to the shifter will occur. tx loading only occurs on the falling edge of ss_ (modes 0 and 1 only). when the block is disabled, the miso output reverts to its idle '1' state. all internal state is reset (including cr0 status) to its configuration specific reset state, except for dr0, dr1, and dr2, which are unaffected. normal operation. typical timing for a spis transfer is shown in figure 17-19 and figure 17-20 . if the spis is pri- marily being used as a receiver, the rx reg full (polling only) or spi complete (polling or interrupt) status may be used to determine when a byte has been received. in this way, the spis operates identically with the spim. however, there are two main areas in which the spis operates differ- ently: 1) spis behavior related to the ss_ signal, and 2) tx data queuing (loading the tx buffer register). figure 17-19. typical spis timing in modes 0 and 1 sclk (internal) tx reg empty d7 miso d6 d5 d2 d1 d0 user writes first byte to the tx buffer register in advance of transfer. at the falling edge of ss_ miso transitions from an idle (high) to output the first bit of data. user writes the next byte to the tx buffer register. sclk (mode 0) last bit of received data is valid on this edge and is latched into rx buffer. sclk (mode 1) ss_ rx reg full first input bit latched. first shift d7 d6 d7
december 22, 2003 document no. 38-12009 rev. *d 213 cy8c22xxx preliminary data sheet 17. digital blocks figure 17-20. typical spis timing in modes 2 and 3 slave select (ss_, active low). slave select must be asserted to enable the spis for receive and transmit. there are two ways to do this: 1. drive the auxiliary input from a pin (selected by the aux io select bits in the output register). this gives the spi master control of the slave selection in a multi-slave environment. 2. ss_ may be controlled in firmware with register writes to the output register. when aux io enable = 1, aux io select bit 0 becomes the ss_ input. this allows the user to save an input pin in single slave environments. when ss_ is negated (whether from an external or internal source), the spis state machine is reset, and the miso out- put is forced to idle at logic '1'. in addition, the spis will ignore any incoming mosi/sclk input from the master. status generation and interrupts. there are four status bits in the spis block: tx reg empty, rx reg full, spi complete, and overrun. the timing of these status bits are identical to the spim, with the exception of tx reg empty which is covered in the section on tx data queuing. status clear on read. refer to the same subsection in ?spim timing? on page 209 . tx data queuing. most spi applications call for data to be sent back from the slave to the master. writing firmware to accomplish this requires an understanding of how the shift register is loaded from the tx buffer register. all modes use the following mechanism: 1) if there is no transfer in progress, 2) if the shifter is empty, and 3) if data is available in the tx buffer register, the byte is loaded into the shifter. the only difference between the modes is that the definition of ?transfer in progress? is slightly different between modes 0 and 1 and modes 2 and 3. figure 17-21 illustrates tx data loading in modes 0 and 1. a transfer in progress is defined to be from the falling edge of ss_ to the point at which the rx buffer register is loaded with the received byte. this means that in order to send a byte in the next transfer, it must be loaded into the tx buffer register before the falling edge of ss_. this ensures a mini- mum setup time for the first bit since the leading edge of the first sclk must latch in the received data. if ss_ is not tog- gled between each byte or is forced low through the configu- ration register, the leading edge of sclk is used to define the start of transfer. however, in this case, the user must provide the required setup time (one-half clock minimum before the leading edge), with a knowledge of system laten- cies and response times. sclk (internal) tx reg empty d7 miso d6 d5 d2 d1 d0 d7 user writes the first byte to the tx buffer register. shifter is loaded with first byte (by leading edge of the sclk). user writes the next byte to the tx buffer register. sclk (mode 2) shifter is loaded with the next byte. last bit of received data is valid on this edge and is latched into rx buffer. sclk (mode 3) rx reg full first input bit latched. first shift
17. digital blocks cy8c22xxx preliminary data sheet 214 document no. 38-12009 rev. *d december 22, 2003 figure 17-21. mode 0 and 1 transfer in progress figure 17-22 illustrates tx data loading in modes 2 and 3. in this case, a transfer in progress is defined to be from the leading edge of the 1 st sclk, to the point at which the rx buffer register is loaded with the received byte. loading the shifter by the leading edge of the clock has the effect of pro- viding the required one-half clock setup time, as the data is latched into the receiver on the trailing edge of the sclk in these modes. figure 17-22. mode 2 and 3 transfer in progress sclk (mode 1) sclk (mode 0) ss forced low ss toggled on a message basis ss toggled on each byte ss transfer in progress sclk (mode 1) sclk (mode 0) ss transfer in progress transfer in progress sclk (mode 1) sclk (mode 0) ss transfer in progress transfer in progress sclk (mode 3) sclk (mode 2) transfer in progress (no dependance on ss)
december 22, 2003 document no. 38-12009 rev. *d 215 cy8c22xxx preliminary data sheet 17. digital blocks 17.3.8 transmitter timing enable/disable operation. as soon as the block is config- ured for transmitter, and before enabling, the primary output is set to idle at logic '1' the mark state. the output will remain '1' until the block is enabled and a transmission is initiated. the auxiliary output will also idle to '1', which is the idle state of the associated spi mode 3 clock. when the transmitter is enabled, the internal reset is released on the divide by 8 clock generator circuit. on the next positive edge of the selected input clock, this 3-bit up- counter circuit, which generates the bit clock with the msb, starts counting up from 00h and is free-running thereafter. when the block is disabled, the clock is immediately gated low. all internal state is reset (including cr0 status) to its configuration specific reset state, except for dr0, dr1, and dr2, which are unaffected. transmit operation. transmission is initiated with a write to the tx buffer register (dr1). the cpu write to this regis- ter is required to have one-half bit clock setup time for the data to be recognized at the next positive internal bit clock edge. as shown in figure 17-23 , once the setup time is met, there is one clock of latency until the data is loaded into the shifter and the start bit is generated to the txd (pri- mary) output. figure 17-23. typical transmitter timing figure 17-24 shows a detail of the tx buffer load timing. the data bits are shifted out on each of the subsequent clocks. following the 8th bit, if parity is enabled, the parity bit is sent to the output. finally, the stop bit is multiplexed into the data stream. with one-half cycle setup to the next clock, if new data is available from the tx buffer register, the next byte is loaded on the following clock edge and the process is repeated. if no data is available, a mark (logic '1') is out- put. figure 17-24. tx buffer load timing the sclk (auxiliary) output has an spi mode 3 clock asso- ciated with the data bits (for the mode 3 timing see figure 17-14 ). during the mark (idle) and framing bits the sclk output is high. status generation. there are two status bits in the trans- mitter cr0 register: tx reg empty and tx complete. tx reg empty indicates that a new byte can be written to the tx buffer register. when the block is enabled, this status bit is immediately asserted. this status bit is cleared when the user writes a byte of data to the tx buffer register and set when the data byte in the tx buffer register is trans- ferred into the shifter. if a transmission is not already in progress, the assertion of this signal initiates one subject to the timing. the default interrupt in the transmitter is tied to tx reg empty. however, an initial interrupt is not generated when the block is enabled. the user must write an initial byte to the tx buffer register. that byte must be transferred into the shifter, before interrupts generated from the tx reg empty status bit are enabled. this prevents an interrupt from occur- ring immediately on block enable. tx complete is an optional interrupt and is generated when all bits of data and framing bits have been sent. it is cleared on a read of the cr0 register. this signal may be used to determine when it is safe to disable the block after data transmission is complete. in an interrupt driven transmitter internal clock tx reg empty start txd (f1) d0 d4 d5 d6 d7 free running clock is clk input divided by 8. user writes first byte to the tx buffer register. shifter is loaded with the first byte. user writes next byte to the tx buffer register. sclk (f2) shifter is loaded with the next byte. stop par tx buffer write needs ? cycle setup time to the internal clock. 1 cycle of latency before start bit at the txd output. start txd iow internal clock txregempty start write is valid on rising edge of low. a tx buffer write valid in this range will result in a start bit 1 cycle, after the subsequent rising edge of the clock.
17. digital blocks cy8c22xxx preliminary data sheet 216 document no. 38-12009 rev. *d december 22, 2003 application, if interrupt on tx complete is selected, the sta- tus must be cleared on every interrupt, otherwise the status will remain high and no subsequent interrupts will be logged. see figure 17-25 for timing relationships. status clear on read. refer to the spim subsection in ?spim timing? on page 209 . figure 17-25. status timing for the transmitter 17.3.9 receiver timing enable/disable operation. as soon as the block is config- ured for receiver, and before enabling, the primary output is connected to the data input (rxd). this output will continue to follow the input, regardless of enable state. the auxiliary output will idle to '1', which is the idle state of the associated spi mode 3 clock. when the receiver is enabled, the internal clock generator is held in reset until a start bit is detected on the input. the block must be enabled with a setup time to the first start bit input. when the block is disabled, the clock is immediately gated low. all internal state is reset (including cr0 status) to its configuration specific reset state, except for dr0, dr1, and dr2, which are unaffected. receive operation. a clock, which must be 8x the desired baud rate, is selected as the clk input. this clock is an input to the rx block clock divider. when the receiver is idle, the clock divider is held in reset. as shown in figure 17-26 , reception is initiated when a start bit (logic '0') is detected on the rxd input. when this occurs, the reset is negated to the clock divider and the 3-bit counter starts an up-count. the block clock is derived from the msb of this counter (cor- responding to a count of 4), which serves to sample each incoming bit at the nominal center point. this clock also sequences the state machine at the specified bit rate. the sampled data is registered into an input flip-flop. this flip-flop feeds the dr0 shift register. only data bits are shifted into the shift register. at the stop sample point, the block is immediately (within 1 cycle of the 24 mhz system clock) set back into an idle state. in this way, the clock generation circuit can immedi- ately enable the search for the next start bit, thereby re- synchronizing the bit clock with the incoming bit rate on every new data byte reception. the rx reg full status bit, as well as error status, is also set at the stop sample point. to facilitate connection to other digital blocks, the rxd input is passed directly to the rxdout (primary) output. the sclk (auxiliary) output has an spi mode 3 clock associated with the data bits (for mode 3 timing see figure 17-26 ). dur- ing the mark (idle) and framing bits the sclk output is high. tx reg empty tx complete full stop bit is sent. cclk txd (f1) d0 d5 d6 d7 sclk (f2) the shifter is loaded from the tx buffer register on this clock edge. a write to the tx buffer register clears this status. start stop
december 22, 2003 document no. 38-12009 rev. *d 217 cy8c22xxx preliminary data sheet 17. digital blocks figure 17-26. receiver operation clock generation and start detection. the input clock selection is a free running 8x over-sampling clock. this clock is used by the clock divider circuit to generate the block clock at the bit rate. as shown in figure 17-27 , the clock block is derived from the msb of a 3 bit counter, giving a sample point as near to the center of the bit time as possi- ble. this block clock is used to clock all internal circuits. since the rxd bit rate is asynchronous to the block bit clock these clocks must be continually re-aligned. this is accom- plished with the start bit detection. when in idle state, the clock divider is held in reset. on start (when the input rxd transitions are detected as a logic '0'), the reset is negated and the divider is enabled to count at the 8x rate. if the rxd input is still logic '0' after 3 samples of the input clock, the status rxactive is asserted, which initiates a reception. if this sample of the rxd line is a logic '1', the input '0' transition was assumed to be spurious, and the receiver remains in the idle state. as shown in figure 17-27 , the internal bit clock (cclk) is running slower than the external tx bit clock and the stop bit is sampled later than the actual center point. after the stop bit is sampled, the 24 mhz reset pulse forces the receiver back to an idle state. in this state, the next start bit search is initiated, resynchronizing the rx bit clock to the tx bit clock. figure 17-27. clock generation and start detection cclk rxd idle start bit0 state bit6 bit7 start bit is detected; clock divider is enabled. input is sampled at the center of the bit time. sclk (f2) par start bit0 d0 d1 d6 d7 par d0 clock divider is re- synchronized from idle on detect of the next start bit. d0 d1 d6 d7 par d0 rxdout (f1) serial data is passed through to the primary output. mode 3 type clock on auxiliary output for data only rx buffer is loaded with the received byte and status is set on stop bit detection edge. idle stop at stop edge, fsm is reset to idle, to search for next start after one 24 mhz clock (42 ns). rx reg full clkin rxd (asynch) start state input is sampled at the center of the bit time. start detection enables the clock divider. cclk reset (clk gen) 0 12 3456701 2 345670 count idle bit0 1 bit0 start bit 01 23 7 0 1 actual center of stop bit. stop bit sample point. width of reset is one 24 mhz clock pulse. next start bit rxactive start is confirmed with another sample at the 3rd sample clock. stop idle stop reset to idle and initiate search for a new start bit.
17. digital blocks cy8c22xxx preliminary data sheet 218 document no. 38-12009 rev. *d december 22, 2003 this resynchronization process (forcing the state back to idle) occurs regardless of the value of the stop bit sample. it is important to reset as soon as possible, so that maximum performance can be achieved. figure 17-28 shows an example where the rx block clock bit rate is slower than the external tx bit rate. the sample point shifts to successively later times. in the extreme case shown, the rx samples the stop bit at the trailing edge. in this case, the receiver has counted 9.5 bit times, while the transmitter has counted 10 bit times. therefore, for a 10-bit message, the maximum theoretical clock offset for the message to be received cor- rectly is represented by one-half bit time, or 5%. if the rx and tx clocks exceed this offset, a logic '0' may be sampled for the stop bit. in this case, the framing error status is set. figure 17-28. example rx re-synchronization this theoretical maximum will be degraded by the resyn- chronization time, which is fixed at approximately 42 ns. in a typical 115.2 kbaud example, the bit time is 8.70 us. in this case the new maximum offset is: ((4.35 us - 42 ns)/4.35 us) x 5% or 4.95% at slower baud rates, this value gets closer to the theoretical maximum of 5%. status generation. there are five status bits in a receiver block: rx reg full, rx active, framing error, overrun, and parity error. all status bits, except rx active and overrun, are set synchronously on the stop bit sample point. rx reg full indicates a byte has been received and trans- ferred into the rx buffer register. this status bit is cleared when the user reads the rx buffer register (dr2). the set- ting of this bit is synchronized to the stop sample point. this is the earliest point at which the framing error status can be set and therefore error status is defined to be valid when rx reg full is set. rx active can be polled to determine if a reception is in progress. this bit is set on start detection and cleared on stop detection. this bit is not sticky and there is no way for the user to clear it. framing error status indicates that the stop bit associ- ated with a given byte was not received correctly (expecting a '1', but got a '0'). this will typically occur when the differ- ence between the baud rates of the transmitter and receiver is greater than the maximum allowed. overrun occurs when there is a received data byte in the rx buffer register and a new byte is loaded into the rx buffer register before the user has had a chance to read the previous one. because the rx buffer register is actually a latch, overrun status is set one-half cycle before rx reg full. this means that although the new data is not available, the previous data has been overwritten because the latch was opened. parity error status indicates that resulting parity calculation on the received byte does not match the value of the parity bit that was transmitted. this status is set on the sample point of the stop signal. status clear on read. refer to the spim subsection in ?spim timing? on page 209 . figure 17-29. status timing for receiver start 11010010 1 rxd stop start rx clock is slower than tx clock. stop bit is just recognized. need to re-sync as soon as possible. any delay in re-sync will cut into the optimal sync of the next byte. sample points are successively later in the bit times. cclk idle start bit0 state bit1 bit5 bit6 bit7 stop rxd d0 d6 d7 d1 rx_reg_full parity_error, framing_error rx_active idle all status except overrun is set synchronously with the stop bit sample point. overrun overrun is set ? cycle before rx reg full.
december 22, 2003 document no. 38-12009 rev. *d 219 section e analog system the analog system section discusses the analog components of the psoc device and the registers associated with those components. this section encompasses the following chapters: analog interface on page 223 analog array on page 231 analog input configuration on page 235 analog reference on page 237 switched capacitor block on page 239 continuous time block on page 245 top-level analog architecture the figure below displays the top-level architecture of the psoc?s analog system. with the exception of analog drivers, each component of the figure is discussed at length in this section. analog drivers are discussed in detail in the analog output drivers chapter on page 61 . psoc analog system block diagram analog input muxing analog system port 0 system bus global analog interconnect analog drivers analog psoc block array analog column digital clocks from core to digital system analog refs ct sc sc
section e analog system cy8c22xxx preliminary data sheet 220 document no. 38-12009 rev. *d december 22, 2003 psoc blocks are user configurable system resources. on- chip analog psoc blocks reduce the need for many mcu part types and external peripheral components. analog psoc blocks are configured to provide a wide variety of peripheral functions. psoc designer software integrated development environment provides automated configura- tion of psoc blocks by selecting the desired functions. psoc designer then generates the proper configuration information and prints a device data sheet unique to that configuration. each of the analog blocks has many potential inputs and several outputs. the inputs to these blocks include analog signals from external sources, intrinsic analog signals driven from neighboring analog blocks, or various voltage refer- ence sources. there are three analog psoc block types: continuous time (ct) blocks, and type c and type d switch capacitor (sc) blocks. ct blocks provide continuous time analog functions. sc blocks provide switched capacitor analog functions. some available supported analog functions are 12-bit incre- mental and 11-bit delta-sigma adc, successive approxima- tion adcs up to 6 bits, dacs up to 8 bits, programmable gain stages, sample and hold circuits, programmable filters, comparators, and a temperature sensor. the analog blocks are organized into columns. there is one analog column in the cy8c22xxx, which contains one con- tinuous time block, one switch capacitor (sc) type c, and one type d switch capacitor (sc). the blocks in a particu- lar column all run off the same clocking source. the blocks in a column also share some output bus resources. refer to the analog interface, on page 223 for additional information. there are three outputs from each analog block. (there are an additional two discrete outputs in the continuous time blocks.) 1. the analog output bus (abus) is an analog bus resource that is shared by all of the analog blocks in a column. only one block in a column can actively drive this bus at any one time and the user has control of this output through register settings. this is the only analog output that can be driven directly to a pin. 2. the comparator bus (cbus) is a digital bus resource that is shared by all of the analog blocks in a column. only one block in a column can be actively driving this bus at any one time and the user has control of this out- put through register settings. 3. the local outputs (out, plus gout, and lout in the continuous time blocks) are routed to neighbor blocks. the various input multiplexer connections (nmux, pmux, rbotmux, amux, bmux, and cmux) all use the output bus from one block as their input. three analog psoc blocks are available separately or com- bined with the digital psoc blocks. a precision internal volt- age reference provides accurate analog comparisons. a temperature sensor input is provided to the analog psoc block array, supporting applications such as battery charg- ers and data acquisition, without requiring external compo- nents. the analog functionality provided is as follows. a/d and d/a converters, programmable gain blocks, comparators, and switched capacitor filters. single ended configuration is cost effective for reason- able speed and accuracy, and provides a simple inter- face to most real-world analog inputs and outputs. support is provided for sensor interfaces, audio codes, embedded modems, and general-purpose opamp cir- cuits. flexible, system on-a-chip programmability, providing variations in functions. for a given function, easily selected trade-offs of accu- racy and resolution with speed, resources (number of analog blocks ), and power dissipated for that applica- tion. the analog section is an ?analog computation unit,? providing programmed steering of signal flow and select- ing functionality through register-based control of analog switches. it also sets coefficients in switched capacitor filters and noise shaping (delta-sigma) modulators, as well as program gains or attenuation settings in amplifier configurations. the architecture provides continuous time blocks and discrete time (switched capacitor) blocks. the continu- ous time blocks allow selection of precision amplifier or comparator circuitry, using programmable resistors as passive configuration and parameter setting elements. the switched capacitor (sc) blocks allow configuration of dacs, delta sigma, incremental or successive approximation adcs, or switched capacitor filters with programmable coefficients.
december 22, 2003 document no. 38-12009 rev. *d 221 cy8c22xxx preliminary data sheet section e analog system analog register summary the table below lists all the psoc registers in the analog system. summary table of the analog registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access analog interface registers 0,64h cmp_cr0 comp[1] aint[1] aint[0] rw : 00 0,66h cmp_cr1 cldis[1] rw : 00 0,65h asy_cr sarcnt[2:0] sarsign sarcol[1] syncen rw : 00 0,e6h dec_cr0 igen[3:0] iclks0 dcol[1:0] dclks0 rw : 00 0,e7h dec_cr1 ecnt idec iclks1 dclks1 rw : 00 1,60h clk_cr0 acolumn1[1:0] rw : 00 1,61h clk_cr1 shdis aclk1[2:0] aclk0[2:0] rw : 00 1,66h amd_cr1 amod1[2:0] rw : 00 1,67h alt_cr0 lut1[3:0] rw : 00 analog input configuration registers 0,60h amx_in aci1[1:0] aci0[1:0] rw : 00 1,62h abf_cr0 acol1mux abuf1en0 bypass pwr rw : 00 analog reference register 0,63h arf_cr hbe ref[2:0] pwr[2:0] rw : 00 switched capacitor block registers switched capacitor block registers, type c x,94h asc21cr0 fcap clockphase asign acap[4:0] rw : 00 x,95h asc21cr1 acmux[2:0] bcap[4:0] rw : 00 x,96h asc21cr2 analogbus compbus autozero ccap[4:0] rw : 00 x,97h asc21cr3 arefmux[1:0] fsw1 fsw0 bmuxsc[1:0] pwr[1:0] rw : 00 switched capacitor block registers, type d x,84h asd11cr0 fcap clockphase asign acap[4:0] rw : 00 x,85h asd11cr1 amux[2:0] bcap[4:0] rw : 00 x,86h asd11cr2 analogbus compbus autozero ccap[4:0] rw : 00 x,87h asd11cr3 arefmux[1:0] fsw1 fsw0 bsw bmuxsd pwr[1:0] rw : 00 continuous time block registers x,74h acb01cr3 lpcmpen cmout insamp exgain rw : 00 x,75h acb01cr0 rtapmux[3:0] gain rtopmux rbotmux[1:0] rw : 00 x,76h acb01cr1 analogbus compbus nmux[2:0] pmux[2:0] rw : 00 x,77h acb01cr2 cphase clatch compcap tmuxen testmux[1:0] pwr[1:0] rw : 00 legend x: an ?x? before the comma in the address field indicates that this register can be accessed or written to no matter what bank is used.
section e analog system cy8c22xxx preliminary data sheet 222 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 223 18. analog interface this chapter explains the analog system interface and its associated registers. the analog system interface is a collection of system level interfaces to the analog array and analog reference block. 18.1 architectural description figure 18-1 displays the top-level diagram of the psoc device?s analog system. 18.1.1 analog data bus interface the analog bus interface isolates the analog array and ana- log system interface registers from the cpu system data bus to reduce bus loading. transceivers are implemented on the system data bus to isolate the analog data bus from the system data bus. this creates a local analog data bus. 18.1.2 analog comparator bus interface each analog column has a dedicated comparator bus asso- ciated with it. every analog psoc block has a comparator output that can drive this bus. however, only one analog block in a column can actively drive the comparator bus for a column at any one time. the output on the comparator bus can drive into the digital blocks as a data input. it also serves as an input to the decimator, as an interrupt input, and is available as read-only data in the analog comparator control register (cmp_cr0, address = bank 0,64h). figure 18-1 illustrates one column of the comparator bus. in the continuous time (ct) analog blocks, the cphase and clatch bits of ct block control register 2 determine whether the output signal on the comparator bus is latched inside the block, and if it is, which clock phase it is latched on. in the switched capacitor (sc) analog blocks, the output on the comparator bus is always latched. the clockphase bit in sc block control register 0 determines the phase on which this data is latched and available. the comparator bus is latched before it is available, to either drive the digital blocks, interrupt, decimator, or be read in the cmp_cr0 register. the latch for each comparator bus is transparent (the output tracks the input) during the high period of phi2. during the low period of phi2, the latch retains the value on the comparator bus during the high-to- low transition of phi2. the cmp_cr0 register is shown in tab l e 1 8- 1 . there is also an option to force the latch in each column into a transparent mode by setting bits in the cmp_cr1 register. table 18-1. analog interface registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access 0,64h cmp_cr0 comp[1] aint[1] rw : 00 0,66h cmp_cr1 cldis[1] rw : 00 0,65h asy_cr sarcnt[2:0] sarsign sarcol[1] syncen rw : 00 0,e6h dec_cr0 igen[3:0] iclks0 dcol[1:0] dclks0 rw : 00 0,e7h dec_cr1 ecnt idec iclks1 dclks1 rw : 00 1,60h clk_cr0 acolumn1[1:0] rw : 00 1,61h clk_cr1 shdis aclk1[2:0] aclk0[2:0] rw : 00 1,66h amd_cr1 amod1[2:0] rw : 00 1,67h alt_cr0 lut1[3:0] rw : 00
18. analog interface cy8c22xxx preliminary data sheet 224 document no. 38-12009 rev. *d december 22, 2003 figure 18-1. an analog comparator bus slice as shown in figure 18-1 , the comparator bus output is gated by a signal from the digital blocks. this feature is used to precisely control the integration period of an incremental adc. there are two direct connect digital block output options per row for driving the gate signal: dbbx1 and dcbx2. this selection may be made with the iccksel bits in registers dec_cr0 and dec_cr1. this function may be enabled on a column-by-column basis by setting the igen bits in the dec_cr0 register. the analog comparator bus output values can be modified or combined with another analog comparator bus through the analog look-up-table function. the lut takes two inputs, a and b, and provides a selection of 16 possible logic functions of those inputs. the lut a and b inputs for each column comparator output is shown in the following table. the lut configuration is set in two control registers, alt_cr0 and alt_cr1. each selection for each column is encoded in four bits. the function value corresponding to the bit encoding is shown in the following table. latch cmp cmp latch cbus driver cbus driver phi1 or phi2 transparent, phi1 or phi2 latch phi2 bypass (cldis, cmp_cr1[7:4]) to col (i-1) lut from col (i+1) inc sel incremental gate, one per column (from digital blocks) destinations 1) comparator register 2) data inputs for digital blocks 3) input to decimator column interrupt phi2 cmp latch cbus driver phi1 or phi2 incremental gate input multiplexer, one per device (from digital blocks) one analog column output to sar accelerator input mux analog comparator bus slice switched capacitor block switched capacitor block continuous time block data output from dcbxx data output from dbbxx table 18-2. a and b inputs for each column comparator output comparator output a b column 0 acmp0 0 column 1 0 0 column 2 0 0 column 3 0 acmp0
december 22, 2003 document no. 38-12009 rev. *d 225 cy8c22xxx preliminary data sheet 18. analog interface 18.1.3 analog column clock generation the analog array switched capacitor blocks require a two- phase non-overlapping clock. the switched cap blocks are arranged in four columns, two to a column (a third block in the column is a continuous time block). an analog column clock generator is provided for each col- umn and this clock is shared among the blocks in that col- umn. the input clock source for each column clock generator is selectable according to the clk_cr0 register. it is important to note that regardless of the clock source selected, the output frequency of the column clock genera- tor is the input frequency divided by four. there are four selections for each column, 24v1, 24v2, aclk0, and aclk1. the 24v1 and 24v2 clock signals are global system clocks. programming options for these system clocks can be accessed in the osc_cr1 register. each of the aclk0 and aclk1 clock selections are driven by a selection of dig- ital block outputs. the settings for the digital block selection are located in register clk_cr1. the timing for analog column clock generation is shown in figure 18-2 . the dead band time between two phases of the clock is designed to be a minimum of 21 ns. figure 18-2. two phase non-overlapping clock generation 18.1.3.1 column clock synchronization when analog signals are routed between blocks in adjacent columns, it is important that the clocks in these columns are synchronized in phase and frequency. frequency synchroni- zation may be achieved by selecting the same input source to two or more columns. however, there is a special feature of the column clock interface logic that provides a resyn- chronization of clock phase. this function is activated on any io write to either the column clock selection register (clk_cr0) or the reference calibration clock register (rcl_cr). a write to either of these registers initiates a syn- chronous reset of the column clock generators, restarting all clocks to a known state. this action will cause all columns with the same selected input frequency to be in phase. writing these registers should be avoided during critical analog processing, as column clocks are all reinitialized and thus a discontinuity in phi1/phi2 clocking will occur. figure 18-3. column clock resynchronize on an io write table 18-3. rdixltx register lutx[3:0] 0h: 0000: false 1h: 0001: a .and. b 2h: 0010: a .and. b 3h: 0011: a 4h: 0100: a .and. b 5h: 0101: b 6h: 0110: a .xor. b 7h: 0111: a .or. b 8h: 1000: a .nor. b 9h: 1001: a .xnor. b ah: 1010: b bh: 1011: a .or. b ch: 1100: a dh: 1101: a .or. b eh: 1110: a. nand. b fh: 1111: true input clk col clk phi1 phi2 underlap is 21 ns to 42 ns. col clk transitions on the falling edge of each phase. cpuclk clk24 col clk reset phi1 iow phi2 source clock setup time to next same input clock write new clock selection all clocks are restarted in phase clock column register
18. analog interface cy8c22xxx preliminary data sheet 226 document no. 38-12009 rev. *d december 22, 2003 18.1.4 decimator and incremental adc interface the decimator and incremental interface provides hardware support and signal routing for analog-to-digital conversion functions, specifically the delta-signal adc and the incre- mental adc. the control signals for this interface is split between two registers: dec_cr0 and dec_cr1. 18.1.4.1 decimator the decimator is a hardware block that is used to perform digital processing on the analog block outputs. the dclks0 and dclks1 bits, which are split between the dec_cr0 and dec_cr1 registers, are used to select a source for the decimator output latch enable. the decimator is typically run autonomously over a given period. the length of this period is set in a timer block that is running in conjunction with the analog processing. at the terminal count of this timer, the primary output goes high for a one-half clock cycle. for purposes of decimator operation, this signal is inverted and connected to the bw input. this becomes the output latch enable signal, which transfers data from the internal accumulators to an output buffer. the terminal count also causes an interrupt and the cpu may read this output buffer at any time between one latch event and the next. 18.1.4.2 incremental adc the analog interface has support for the incremental adc operation through the ability to gate the analog comparator outputs. this gating function is required in order to precisely control the digital integration period that is performed in a digital block, as part of the function. a digital block pwm is used as a source to provide the gate signal. only one source for the gating signal can be selected. however, the gating can be applied independently to any of the column comparator outputs. the iclks0 and iclks1 bits, which are split between the dec_cr0 and dec_cr1 registers, are used to select a source for the incremental gating signal. the four igen bits are used to independently enable the gating function on a column-by-column basis. 18.1.5 analog modulator interface (mod bits) the analog modulator interface provides a selection of sig- nals that are routed to any of the four analog array modula- tion control signals. there is one modulation control signal for each type c analog switched capacitor block in every analog column. there are eight selections, which include the analog comparator bus outputs, two global outputs, and a digital block broadcast bus. the selections for all columns are identical and are contained in the amd_cr0 and amd_cr1 registers. the mod bit is xor?ed with the switched capacitor block sign bit (asign in ascxxcr0) to provide dynamic control of that bit. 18.1.6 analog synchronization interface (stalling) for high precision analog operation, it is necessary to pre- cisely time when updated register values are available to the analog psoc blocks. the optimum time to update values in switch cap registers is at the beginning of the phi1 active period. depending on the relationship between the cpu clk and the analog column clock, the cpu io write cycle can occur at any 24 mhz master clock boundary in the phi1 or phi2 cycle. register values may be written at arbitrary times; however, glitches may be apparent at analog outputs. this is because the capacitor value is changing when the circuit is designed to be settling. the syncen bit in the analog synchronization control register (asy_cr) is designed to address this problem. when the syncen bit is set, an io write instruction to any switch cap registers is blocked at the interface and the cpu will stall. on the subsequent rising edge of phi1, the cpu stall is released, allowing the io write to be performed at the destination analog register. this mode synchronizes the io write action to be performed at the optimum point in the ana- log cycle, at the expense of cpu bandwidth. figure 18-4 shows the timing for this operation. figure 18-4. synchronized write to a dac register as an alternative to stalling, the source for the analog col- umn interrupts is set as the falling edge of the phi2 clock. this configuration synchronizes the cpu to perform the io write after the phi2 phase is completed, which is equivalent to the start of phi1. 18.1.7 sar hardware acceleration the sar algorithm is a binary search on the dac code that best matches the input voltage that is being measured. the first step is to take an initial guess at mid-scale, which effec- tively splits the range by half. the dac output value is then compared to the input voltage. if the guess is too low, a result bit is set for that binary position and the next guess is set at mid-scale of the remaining upper range. if the guess is too high, a result bit is cleared and the next guess is set at mid-scale of the remaining lower range. this process is repeated until all bits are tested. the resulting dac code is cpuclk (generated) cpuclk (to cpu) iow stall phi clk24 aiow stall is released here. aiow completes here.
december 22, 2003 document no. 38-12009 rev. *d 227 cy8c22xxx preliminary data sheet 18. analog interface the value that produces an output voltage closest to the input voltage. this code should be within 1 lsb of the input voltage. the successive approximation a/d algorithm requires the following building blocks: a dac, a comparator, and a method or apparatus to sequence successive writes to the dac based on the comparator output. the sar hardware accelerator represents a trade off between a fully automatic hardware sequencing approach and a pure firmware approach. 18.1.7.1 architectural description figure 18-5. sar hardware accelerator as shown in figure 18-5 , the sar accelerator hardware is interfaced to the analog array through the comparator output and the analog array data bus. to create dac output, val- ues are written directly to the acap field in the dac regis- ter. to facilitate the sequencing of the dac writes in the sar algorithm, the m8c is programmed to do a sequence of read, modify, and write instructions. this is an atomic operation that consists of an io read (ior) followed closely by an io write (iow). one example of an assembly level instruction is as follows. or reg[dac_reg],0 the effect of this instruction is to read the dac register, and follow it closely in time by a write back. the or instruction does not modify the read data (it is or?ed with ?0?). the cpu does not need to do any additional computation in conjunc- tion with this procedure. the sar hardware transparently does the data modification during the read portion of the cycle. the only purpose for executing this instruction is to initiate a read that is modified by the sar hardware, then to follow up with a write that transfers the data back to the dac register. during each io read operation, the sar hardware overrides two bits of the data: to correct the previous bit guess based on the current comparator value. to set the next guess (next least significant bit). the cpu latches this sar modified data, or?s it with 0 (no cpu modification), and writes it back to the dac register. a counter in the sar hardware is used to decode which bits are being operated on in each cycle. in this way, the capa- bility of the cpu and the ior/iow control lines are used to implement the read and write. however, use the sar accel- erator hardware to make the decisions and to control the values written, achieving the optimal level of performance for the current system. the sar hardware is designed to process 6 bits of a result in a given sequence. a higher resolution sar is imple- mented with multiple passes. 18.1.7.2 sar timing another important function of the sar hardware is to syn- chronize the io read (the point at which the comparator value is used to make the sar decision) to when the analog comparator bus is valid. under normal conditions, this point is at the rising edge of phi1 for the previous compute cycle. when the or instruction is executed in the cpu, a few cpu clock cycles into the instruction, an ior signal is asserted to initiate a read of the dac register. the sar hardware then stalls the cpu clock, for one 24 mhz clock cycle after the rising edge of phi1. when the stall is released, the io read completes and is immediately followed by an io write. in this sequence of events, the dac register is written with the new value within a few cpu clocks after phi1. the rising edge of phi1 is also the optimal time to write the dac register for maximum settling time. the timing from the positive edge of phi1 to the start of the io write is 4.5 clocks, which at 24 mhz, is 189 ns. if the analog clock is running at one mhz, this allows over 300 ns for the dac output and comparator to settle. dac register analog data bus analog input system data bus sar accelerator m8c micro dac cmp latch cbus driver phi1 or phi2 sar accelerator input mux comparator bus outputs from other columns switched capacitor block db read
18. analog interface cy8c22xxx preliminary data sheet 228 document no. 38-12009 rev. *d december 22, 2003 figure 18-6. general sar timing 18.2 register definitions 18.2.1 cmp_cr0 register this register contains one field. bit 5, comp[1], is the read- only bit corresponding to the comparator bit in the analog column. this bit is synchronized to the column clock, and thus may be reliably polled by the cpu. bit 1, aint[1], selects the interrupt source for the column as the input to the interrupt controller: by default, the interrupt is the comparator bit. however, if a bit in this field is set, the interrupt for that column will be derived from the falling edge of phi2 clock for that column. firmware can use this capability to synchronize to the cur- rent column clock. for additional information, reference the cmp_cr0 register on page 103 . 18.2.2 cmp_cr1 register the cldis bits in this register are used to override the ana- log column comparator synchronization. when these bits are set, the given column is not synchronized to phi2 in the analog interface. this capability is typically used to allow a continuous time comparator result to propagate directly to the interrupt controller during sleep. since the master clocks (except the 32k clock) are turned off during sleep, the syn- chronizer must be bypassed. for additional information, reference the cmp_cr1 register on page 105 . 18.2.3 asy_cr register the sar hardware control bits are located in the asy_cr register. all bits are relevant to sar operation except for bit 0, syncen. syncen is associated with analog register write stalling and is described in the analog interface syn- chronization section. the sar hardware accelerator is a block of specialized hardware designed to sequence the sar algorithm for effi- cient a/d conversion. a sar adc is implemented concep- tually with a dac of the desired precision and a comparator. this functionality is configured from one or more psoc blocks. for each conversion, the firmware should initialize the asy_cr register and set the sign bit of the dac as the first guess in the algorithm. a sequence of or instructions (read, modify, write) to the dac (cr0) register is then exe- cuted. each of these or instructions causes the sar hard- ware to read the current state of the comparator, checking the validity of the previous guess. it either clears it or leaves it set, accordingly. the next lsb in the dac register is also set as the next guess. six or instructions will complete the conversion of a 6-bit dac. the resulting dac code, which matches the input voltage to within 1 lsb, is then read back from the dac cr0 register. bits 7 and 1: reserved. bits 6, 5, and 4: sarcnt[2:0]. sar count value. these three bits are used to initialize a 3-bit counter to sequence the 6 bits of the sar algorithm. typically, the user would ini- tialize this register to ?6?. when these bits are any value phi1 phi2 acmp ior iow stall comparator is valid on phi1 rising. sar computation is done and ior finishes. dac output is valid at end of phi2. comparator is now valid for previous iow, repeat process. ior causes stall to assert, to wait for phi1 rising. new value is written to dac register.
december 22, 2003 document no. 38-12009 rev. *d 229 cy8c22xxx preliminary data sheet 18. analog interface other than ?0?, an ior command to an sc block is assumed to be part of a sar sequence. assuming the comparator bus output is programmed for col- umn 0, a typical firmware sequence would be as follows. mov reg[asy_cr], 60h // sar count value=6, sign=0, col=0 or reg[asc10cr0], 0 // check sign, set bit 4 or reg[asc10cr0], 0 // check bit 4, set bit 3 or reg[asc10cr0], 0 // check bit 3, set bit 2 or reg[asc10cr0], 0 // check bit 2, set bit 1 or reg[asc10cr0], 0 // check bit 1, set bit 0 or reg[asc10cr0], 0 // check bit 0 bit 3: sarsign. sar sign selection. this bit optionally inverts the comparator input to the sar accelerator and must be set based on the type of psoc block configuration selected. tab l e 1 8- 4 lists some typical examples. bits 2 and 1: sarcol[1:0]. column select for the sar comparator input. the dac portion of the sar can reside in any of the appropriate positions in the analog psoc block array. however, once the comparator block is posi- tioned (and it is possible to have the dac and compara- tor in the same block), this position should be the column selected. bit 0: syncen. the purpose of this bit is to synchronize cpu data writes to switched capacitor (sc) block operation in the analog array. the sc block clock is selected in the clk_cr0 register. the selected clock source is divided by four and the output is a pair of two-phase, non-overlapping clocks: phi1 and phi2. there is an optimal time, with respect to the phi1 and phi2 clocks, to change the capaci- tor configuration in the sc block which is typically the rising edge of phi1. this is normally the time when the input branch capacitor is charging. when this bit is set, any write to an sc block register is stalled until the rising edge of the next phi1 clock phase, for the column associated with the sc block address. the stall- ing operation is implemented by suspending the cpu clock. no cpu activity will occur during the stall, including interrupt processing. therefore, the effect of stalling on cpu through- put must be considered. for additional information, reference the asy_cr register on page 104 . 18.2.4 dec_cr0 register this register contains control bits to access hardware sup- port for both the incremental adc and the delisg adc. for incremental support, the upper four bits, igen[3:0], select which column comparator bit will be gated by the out- put of a digital block. the output of that digital block is typi- cally a pwm signal; the high time of which corresponds to the adc conversion period. this ensures that the compara- tor output is only processed for the precise conversion time. the digital block selected for the gating function is controlled by iclks0 in this register, and iclks2 and iclks1 bits in dec_cr1. up to one of eight digital blocks may be selected, depending on the chip resources. the delsig adc uses the hardware decimator to do a por- tion of the post processing computation on the comparator signal. dcol[1:0] selects the column source for the decima- tor data (comparator bit) and clock input (phi clocks). in addition, the decimator requires a timer signal to sample the current decimator value to an output register that may subsequently be read by the cpu. this timer period is set to be a function of the delsig conversion time and may be selected from up to one of eight digital blocks (depending on the chip resources) with bit dclks0 and dclks2, dclks1 in dec_cr1. for additional information, reference the dec_cr0 register on page 140 . 18.2.5 dec_cr1 register bit 7: ecnt. the ecnt bit is a mode bit that controls the operation of the decimator hardware block. by default, the decimator is set to a double integrate function, for use in hardware delsig processing. when the ecnt bit is set, the decimator block converts to a single integrate function. this gives the equivalent of a 16-bit counter suitable for use in hardware support for an incremental adc function. bit 6: idec. any function using the decimator requires a digital block timer to sample the current decimator value. normally, the positive edge of this signal will cause the deci- mator output to be sampled. however, when the idec bit is set, the negative edge of the selected digital block input will cause the decimator value to be sampled. bits 5 to 0: iclksx and dclksx. the iclks1 and dclks1 bits in this register select the digital block sources for incremental and delsign adc hardware support (see the dec_cr0 register). for additional information, reference the dec_cr1 register on page 141 . table 18-4. typical psoc block configurations configuration description sign sar6 ? 2 blocks 1 dac6, 1 comp (could be ct) 0 sar6 ? 1 block 1 for both dac6 and comp 1 ms sar10 ?3 blocks 1 dac10, 1 comp (could be ct) (when processing ms dac block) 0
18. analog interface cy8c22xxx preliminary data sheet 230 document no. 38-12009 rev. *d december 22, 2003 18.2.6 clk_cr0 register an analog column clock generator is provided for each col- umn. the bits in this register select the source for each col- umn clock generator. regardless of the source selected, the input clock is divided by four to generate the phi1/phi2 non- overlapping clocks for the column. there are four selections for each clock: vc1, vc2, aclk0, and aclk1. vc1 and vc2 are the programmable global system clocks. aclk0 and aclk1 sources are each selected from up to one of four digital block outputs (functioning as clock generators) as selected by clk_cr1. for additional information, reference the clk_cr0 register on page 154 . 18.2.7 clk_cr1 register bit 7: reserved. bit 6: shdis. the shdis bit in the clk_cr1 register is described as follows. during normal operation of an sc block for the amplifier of a column enabled to drive the output bus, the connection is only made for the last half of phi2 (during phi1 and for the first half of phi2, the output bus floats at the last voltage to which it was driven). this forms a sample and hold opera- tion using the output bus and its associated capacitance. this design prevents the output bus from being perturbed by the intermediate states of the sc operation (often a reset state for phi1 and settling to the valid state during phi2). following are the exceptions: 1) if the clockphase bit in cr0 (for the sc block in question) is set to 1, then the out- put is enabled for the whole of phi2. 2) if the shdis signal is set in bit 6 of the analog clock source control register, then sample and hold operation is disabled for all columns and all enabled outputs of sc blocks are connected to their respective output busses for the entire period of their respective phi2s. bits 5 to 0: aclkx. there are two 3-bit fields in this regis- ter that can select up to one of eight digital blocks (depend- ing on chip resources), to function as the clock source for aclk0 and aclk1. aclk0 and aclk1 are alternative clock inputs to the analog column clock generators (see the clk_cr0 register). for additional information, reference the clk_cr1 register on page 155 . 18.2.8 amd_cr1 register this register controls the selection of the modbit for ana- log column 1. see the amd_cr0 register. for additional information, reference the amd_cr1 register on page 157 . 18.2.9 alt_cr0 register this register controls the selection of logic functions that may be selected for the analog comparator bits in column 1. a one of 16 look-up table (lut) is applied to the outputs of each column comparator bit and optionally a neighbor bit to implement two input logic functions. tab l e 1 8- 2 shows the available functions, where the a input applies to the selected column, and the b input applies to the next most significant neighbor column. for cy8c22xxx parts, there is only one column and b=0. for additional information, reference the alt_cr0 register on page 158 .
december 22, 2003 document no. 38-12009 rev. *d 231 19. analog array this chapter presents the analog array. it has no registers associated with it. the analog blocks can be used to implement a wide range of functions, limited only by the designer?s imagination. the following functions operate within the capability of the analog psoc blocks using one analog psoc block, multiple analog blocks, a combination of more than one type of ana- log block, or a combination of analog and digital psoc blocks. most of these functions are currently available as user modules in psoc designer. others will be added in the future. reference the psoc designer user modules data book for additional information. delta-sigma a/d converters successive approximation a/d converters incremental a/d converters programmable gain/loss stage analog comparators zero-crossing detectors low-pass filter band-pass filter notch filter amplitude modulators amplitude demodulators sine-wave generators sine-wave detectors sideband detection sideband stripping audio output drive dtmf generator fsk modulator by modifying registers, as described in this data sheet, users can configure psoc blocks to perform these functions and more. 19.1 architectural description the analog array is designed to allow moving between fami- lies without modifying projects, except for resource limita- tions. the psoc device has only one column (column 1). gener- ally, nets that were inputs to the missing columns are left floating. the nets that were outputs from the missing col- umns are connected to vss. see the following figures for specific details. figure 19-1. array of analog psoc blocks analog column 1 acb01 asd11 asc21
19. analog array cy8c22xxx preliminary data sheet 232 document no. 38-12009 rev. *d december 22, 2003 the figures that follow illustrate the analog mux connections for the psoc device. figure 19-2. nmux connections figure 19-3. pmux connections figure 19-4. rbotmux connections the acmux, as shown in the analog switch cap type c block xx control 1 register, controls the input muxing for both the a and c capacitor branches. the high order bit, acmux[2], selects one of two inputs for the c branch. see the individual amux and cmux diagrams. figure 19-5. amux connections acb 01 asd 11 asc 21 (6) (5) agnd (1) (0) (2) avdd (vdd) reflo (vss) (3) (3) (4) (7) port inputs nc nc acb 01 asd 11 asc 21 (0) (1) (5) (4) agnd (3) (2) (6) port inputs abus 1 (3) (7) nc nc asd 11 asc 21 agnd v ss acb 01 insamp (rb=2) insamp (rb=3) insamp (rb=1) nc nc (2) (5) (0) (0) (3) refhi (vcc) vtemp acb 01 asd 11 asc 21 abus(1) ( 4 ) (1) (7) (6) (3) ( 2 ) ( 4 ) (1) (5) nc nc nc nc nc nc nc
december 22, 2003 document no. 38-12009 rev. *d 233 cy8c22xxx preliminary data sheet 19. analog array figure 19-6. cmux connections figure 19-7. bmuxsc/sd connections 19.1.1 analog comparator bus each analog column has a dedicated comparator bus asso- ciated with it. every analog psoc block has a comparator output that can drive out on this bus. however, the compara- tor output from only one analog block in a column can be actively driving the comparator bus for that column at any one time. the output on the comparator bus can drive into the digital blocks and is also available to be read in the cmp_cr register. the comparator bus is latched before it is available to either drive the digital blocks or be read in the analog comparator control register. the latch for each comparator bus is trans- parent (the output tracks the input), during the high period of phi2. during the low period of phi2, the latch retains the value on the comparator bus during the high to low transition of phi2. the output from the analog block that is actively driving the bus may also be latched internally to the analog block itself. in the continuous time (ct) analog blocks, the cphase and clatch bits inside the analog continuous time type b block xx control register 2 determine whether the output signal on the comparator bus is latched inside the block, and if it is, which clock phase it is latched on. in the sc analog blocks, the output on the comparator bus is always latched. the clockphase bit in the analog switch- cap type b block xx control register 0 or the analog switchcap type b block xx control register 0 determines the phase on which this data is latched and available. 19.2 temperature sensing capability a temperature-sensitive voltage, derived from the bandgap sensing on the die, is buffered and available as an analog input into the analog switch cap type c block asc21. temperature sensing allows protection of device operating ranges for fail-safe applications. temperature sensing, com- bined with a long sleep timer interval (to allow the die to approximate ambient temperature), can give an approxi- mate ambient temperature for data acquisition and battery charging applications. the user may also calibrate the inter- nal temperature rise based on a known current consump- tion. the temperature sensor input to the asc21 block is labeled vtemp and its associated ground reference is labeled tref- gnd. acb 01 asd 011 asc 21 (0-7) acb 01 asd 11 asc 21 (0) (1) (2) (3) trefgnd (0) nc ( 1 ) nc nc
19. analog array cy8c22xxx preliminary data sheet 234 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 235 20. analog input configuration this chapter briefly discusses the analog input configuration and its associated registers. the input multiplexor maps device inputs to analog array columns, based on bit values in the amx_in and abf_cr0 registers. edge columns are fed by one 4:1 mux; inner col- umns are fed by 1 of 2 4:1 muxes. the muxes are cmos switches with typical resistances in the range of 2k ohms. reference the analog block diagrams, on the following pages, to view the various analog input configurations. the cy8c22xxx device uses only one ?internal? column (column 1) and has unique analog mux connectivity from port 0 (8:1 into ct block). this device contains a more lim- ited reference block than larger family members. 20.1 register definitions 20.1.1 amx_in register bits 7 to 4: reserved. bits 3 to 0: aci1[1:0] and aci0[1:0]. these bits control the analog muxes that feed signals in from port pins into the analog column. the analog column can have up to eight port bits connected to its muxed input. aci1 and aci0 are used to select among even and odd pins. the ac1mux bit field controls the bits for those muxes and is located in the analog output buffer control register (abf_cr). for additional information, reference the amx_in register on page 101 . 20.1.2 abf_cr0 register this register controls analog input muxes from port 0, and the output buffer amplifiers that drive column outputs to device pins. bit 7: acol1mux. a mux selects the output of column 0 input mux or column 1 input mux. when set, this bit sets the column 1 input to column 0 input mux output. bit 6: reserved. bit 5: abuf1en0. this bit enables or disables the column output amplifiers. bits 4, 3, and 2: reserved. bit 1: bypass. bypass mode connects the amplifier input directly to the output. when this bit is set, all amplifiers con- trolled by the register will be in bypass mode. bit 0: pwr. this bit is used to set the power level of the amplifiers. when this bit is set, all amplifiers controlled by the register will be in a high power state. for additional information, reference the abf_cr0 register on page 156 . table 20-1. analog input configuration registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access 0,60h amx_in aci1[1:0] aci0[1:0] rw : 00 1,62h abf_cr0 acol1mux abuf1en0 bypass pwr rw : 00
20. analog input configuration cy8c22xxx preliminary data sheet 236 document no. 38-12009 rev. *d december 22, 2003 20.2 architectural description figure 20-1. analog pin block diagram acol1mux p0[6] p0[4] p0[2] p0[0] refhi reflo agnd reference generators microcontroller interface (address bus, data bus, etc.) array p0[7] p0[5] p0[3] p0[1] 20 or 32 pin part 8 pin part array input configuration interface to digital system aci0[1:0] aci1[1:0] acb01 asd11 asc21
december 22, 2003 document no. 38-12009 rev. *d 237 21. analog reference this chapter discusses the analog reference generator and its associated register. this device uses a fixed analog ground of vdd/2. 21.1 architectural description the psoc device is a single supply part, with no negative voltage available or applicable. analog ground (agnd) is constructed near mid-supply. this ground is routed to all analog blocks and separately buffered within each block. note that there may be a small offset voltage between buff- ered analog grounds. refhi and reflo signals are gener- ated, buffered, and routed to the analog blocks. refhi and reflo are used to set the conversion range (i.e., span) of analog to digital (adc) and digital to analog (dac) convert- ers. the reference array supplies voltage to all blocks and cur- rent to the switched capacitor blocks. at higher block clock rates, there is increased reference current demand; the ref- erence power should be set equal to the highest power level of the analog blocks used. figure 21-1. reference structure figure 21-2. analog reference control schematic table 21-1. analog reference register address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access 0,63h arf_cr hbe ref[2:0] pwr[2:0] rw : 00 vss vagnd agnd refhi reflo v refhi v reflow refhi to analog blocks vdd vss reflo to analog blocks agnd (vdd/2) x1
21. analog reference cy8c22xxx preliminary data sheet 238 document no. 38-12009 rev. *d december 22, 2003 21.2 register definitions 21.2.1 arf_cr register bit 7: reserved. bit 6: hbe. bias level (hbe) controls the bias level for all analog functions. it operates with the power setting in each block, to set the parameters of that block. most applications will benefit most from the low bias level. at high bias, the analog block opamps have faster slew rate but slightly less voltage swing and higher power. bits 5 to 3: ref[2:0]. only the 010b setting is valid in the cy8c22xxx device. this sets agnd to vdd/2, refhi=vdd, and reflo=vss. bits 2, 1, and 0: pwr[2:0]. pwr controls the bias current and bandwidth for all of the opamps in the analog reference block. pwr also provides on/off control in various rows of the analog array. see tab l e 2 1- 2 . for additional information, reference the arf_cr register on page 102 . table 21-2: analog array power control bits pwr[2:0] ct row both sc rows ref bias 000b off off off 001b on off low bias 010b on off medium bias 011b on off high bias 100b off off off 101b on on low bias 110b on on medium bias 111b on on high bias
december 22, 2003 document no. 38-12009 rev. *d 239 22. switched capacitor block this chapter presents the analog switched capacitor block and its associated registers. the analog switched capacitor (sc) blocks are built around a low offset, low noise operational amplifier. the analog switched capacitor blocks are built around a rail-to-rail, input and output, low offset and low noise opamp. there are several analog muxes controlled by register-bit settings in the control registers that determine the signal topology inside the block. there are four user selectable capacitor arrays inside this block connected to the opamp. the block also contains a low power comparator, connected to the same inputs and outputs as the main amplifier. this comparator is useful for providing a digital compare output in low power sleep modes, when the main amplifier is powered off. the four arrays are labeled a cap array, b cap array, c cap array, and f cap array, and have user selectable unit values: one array is in the feedback path of the opamp and three arrays are in the input path of the opamp. analog muxes, controlled by bit settings in control registers, set the capacitor topology inside the block. a group of muxes are used for the signal processing switch synchronously to clocks phi1 and phi2, with behavior that is modified by con- trol register settings. there is also an analog comparator that converts the opamp output (relative the local analog ground) into a digital signal. there are two types of analog switched capacitor blocks called type c and type d. their primary differences relate to connections of the c cap array and the block?s position in a two pole filter section. the type d block also has greater flexibility in switching the b cap array. there are three discrete outputs from this block. these out- puts connect to the following buses: 1. the analog output bus (abus), which is an analog bus resource shared by all of the analog blocks in the col- umn. this signal may also be routed externally through the output buffer. 2. the comparator bus (cbus), which is a digital bus resource shared by all of the analog blocks in the col- umn. 3. the local output bus (out), which is an analog node which is routed to neighboring block inputs. table 22-1. analog switched capacitor block registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access analog switch cap type c psoc block control registers x,xxh ascxxcr0 fcap clockphase asign acap[4:0] rw : 00 x,xxh ascxxcr1 acmux[2:0] bcap[4:0] rw : 00 x,xxh ascxxcr2 analogbus compbus autozero ccap[4:0] rw : 00 x,xxh ascxxcr3 arefmux[1:0] fsw1 fsw0 bmuxsc[1:0] pwr[1:0] rw : 00 analog switch cap type d psoc block control registers x,xxh asdxxcr0 fcap clockphase asign acap[4:0] rw : 00 x,xxh asdxxcr1 amux[2:0] bcap[4:0] rw : 00 x,xxh asdxxcr2 analogbus compbus autozero ccap[4:0] rw : 00 x,xxh asdxxcr3 arefmux[1:0] fsw1 fsw0 bsw bmuxsd pwr[1:0] rw : 00 legend x: an ?x? before the comma in the address field indicates that the register exists in both register banks. xx: an ?x? after the comma in the address field indicates that there are multiple instances of the register. for an expanded ad dress listing of these registers, refer to the ?analog register summary? on page 221 .
22. switched capacitor block cy8c22xxx preliminary data sheet 240 document no. 38-12009 rev. *d december 22, 2003 22.1 architectural description figure 22-1. analog switch cap type c psoc blocks 1 * fsw0 1 * !autozero bmuxsc bqtap abus c inputs ccap bcap acap 0,1,?,30,31 c fcap 16,32 c 2 +autozero 1 *autozero ( 2 +!autozero) * fsw1 power analogbus* 2 b 1 asign arefmux out 2 1 refhi reflo agnd acmux a inputs b inputs cbus cbus driver 0,1,?,30,31 c 0,1,?,30,31 c modulation inputs mod bit control 2 2 1 (comparator)
december 22, 2003 document no. 38-12009 rev. *d 241 cy8c22xxx preliminary data sheet 22. switched capacitor block figure 22-2. analog switch cap type d psoc blocks 22.2 application description the analog switched capacitor blocks support delta- sigma, successive approximation, and incremental a/d conversion, capacitor dacs, and sc filters. they have three input arrays of binary-weighted switched capacitors, allowing user programmability of the capacitor weights. this provides summing capability of two (cdac) scaled inputs and a non-switched capacitor input. the non-switched capacitor node is labeled ?bqtap? in the figure above. the local connection of bqtap is vertical between the sc blocks for the cy8c22xxx. since the input of sc block c has this additional switched capacitor, it is configured for the input stage of such a switched capacitor biquad filter. when followed by an sc block d integrator, this combination of blocks can be used to provide a full switched capacitor biquad. 22.3 register definitions the x cap field is used to store the binary encoded value for capacitor x , where x can be a (acap), b (bcap), or c (ccap), in both the ascxxcrx and asdxxcrx registers. figure 22-3 illustrates the switch settings for the example acap[4:0]=14h=10100b=20d. figure 22-3. example switch capacitor settings 1 * fsw0 power 1 *bsw 2 +!bsw bmuxscd b inputs bqtap ccap bcap acap fcap 16,32 c 1 *autozero ( 2 +!autozero) * fsw1 2 +autozero 1 *bsw*!autozero 2 +!bsw+autozero abus analogbus* 2 b out 1 * !autozero 2 1 a inputs asign arefmux refhi reflo agnd a mux 0,1,?,30,31 c 0,1,?,30,31 c 0,1,?,30,31 c cbus cbus driver 2 1 (comparator) 16c 8c 4c 2c 1c agnd agnd 1 0 0 0 agnd 1 agnd agnd bottom top
22. switched capacitor block cy8c22xxx preliminary data sheet 242 document no. 38-12009 rev. *d december 22, 2003 analog switch cap type c psoc block control registers 22.3.1 ascxxcr0 register bit 7: fcap. this bit controls the size of the switched feed- back capacitor in the integrator. bit 6: clockphase. this bit controls the internal clock phasing relative to the input clock phasing. clockphase affects the output of the analog column bus, which is con- trolled by the analogbus bit in control 2 register (asc21cr2). bit[6] is the clockphase select that inverts the clock internal to the blocks. during normal operation of an sc block for the amplifier of a column enabled to drive the output bus, the connection is only made for the last half of phi2 (during phi1 and for the first half of phi2, the output bus floats at the last voltage to which it was driven). this forms a sample and hold operation using the output bus and its associated capacitance. this design prevents the output bus from being perturbed by the intermediate states of the sc operation (often a reset state for phi1 and settling to the valid state during phi2). following are the exceptions: 1) if the clockphase bit in cr0 (for the sc block in question) is set to 1, then the out- put is enabled for the whole of phi2. 2) if the shdis signal is set in bit 6 of the analog clock source control register, then sample and hold operation is disabled for all columns and all enabled outputs of sc blocks are connected to their respective output busses for the entire period of their respective phi2s. this bit also affects the latching of the comparator output (cbus). both clock phases, phi1 and phi2, are involved in the output latching mechanism. the capture of the next value to be output from the latch (capture point event) hap- pens during the falling edge of one clock phase, and the ris- ing edge of the other clock phase will cause the value to come out (output point event). this bit determines which clock phase triggers the capture point event, and the other clock will trigger the output point event. the value output to the comparator bus will remain stable between output point events. bit 5: asign. this bit controls the switch phasing of the switches on the bottom plate of the acap capacitor. the bot- tom plate samples the input or the reference. bits 4 to 0: acap[4:0]. the acap bits set the value of the capacitor in the a path. for additional information, reference the ascxxcr0 register on page 110 . 22.3.2 ascxxcr1 register bits 7, 6, and 5: acmux[2:0]. acmux controls the input muxing for both the a and c capacitor branches. the high order bit, acmux[2], selects one of two inputs for the c branch. bits 4 to 0: bcap[4:0]. the bcap bits set the value of the capacitor in the b path. for additional information, reference the ascxxcr1 register on page 111 . 22.3.3 ascxxcr2 register bit 7: analogbus. this bit gates the output to the analog column bus. the output on the analog column bus is affected by the state of the clockphase bit in control 0 reg- ister ( asc21cr0). if analogbus is set to 0, the output to the analog column bus is tri-stated. if analogbus is set to 1, the signal that is output to the analog column bus is selected by the clockphase bit. if the clockphase bit is 0, the block out- put is gated by sampling clock on last part of phi2. if the clockphase bit is 1, the block output continuously drives the analog column bus (abus). bit 6: compbus. this bit controls the output to the column comparator bus (cbus). note that if the comparator bus is not driven by anything in the column, it is pulled low. the comparator output is evaluated on the rising edge of internal phi1 and is latched so it is available during internal phi2. bit 5: autozero. this bit controls the shorting of the output to the inverting input of the opamp. when shorted, the opamp is basically a follower. the output is the opamp off- set. by using the feedback capacitor of the integrator, the block can memorize the offset and create an offset cancella- tion scheme. autozero also controls a pair of switches between the a and b branches and the summing node of the opamp. if autozero is enabled, then the pair of switches is active. autozero also affects the function of the fsw1 bit in control 3 register. bits 4 to 0: ccap[4:0]. the ccap bits set the value of the capacitor in the c path. for additional information, reference the ascxxcr2 register on page 112 .
december 22, 2003 document no. 38-12009 rev. *d 243 cy8c22xxx preliminary data sheet 22. switched capacitor block 22.3.4 ascxxcr3 register bits 7 and 6: arefmux[1:0]. these bits select the refer- ence input of the a capacitor branch. bit 5: fsw1. this bit is used to control a switch in the inte- grator capacitor path. it connects the output of the opamp to the integrating cap. the state of the feedback switch is affected by the state of the autozero bit in control 2 regis- ter (asc21cr2). if the fsw1 bit is set to 0, the switch is always disabled. if the fsw1 bit is set to 1, the autozero bit determines the state of the switch. if the autozero bit is 0, the switch is enabled at all times. if the autozero bit is 1, the switch is enabled only when the internal phi2 is high. bit 4: fsw0. this bit is used to control a switch in the inte- grator capacitor path. it connects the output of the opamp to analog ground. bits 3 and 2: bmuxsc[1:0]. these bit control the muxing to the input of the b capacitor branch. bits 1 and 0: pwr[1:0]: the power bits serve as encoding for selecting one of four power levels. the block always powers up in the off state. for additional information, reference the ascxxcr3 register on page 113 . analog switch cap type d psoc block control registers 22.3.5 asdxxcr0 register bit 7: fcap. this bit controls the size of the switched feed- back capacitor in the integrator. bit 6: clockphase. this bit controls the internal clock phasing relative to the input clock phasing. clockphase affects the output of the analog column bus which is con- trolled by the analogbus bit in control 2 register (asd11cr2). bit[6] is the clockphase select that inverts the clock internal to the blocks. during normal operation of an sc block for the amplifier of a column enabled to drive the output bus, the connection is only made for the last half of phi2 (during phi1 and for the first half of phi2, the output bus floats at the last voltage to which it was driven). this forms a sample and hold operation using the output bus and its associated capacitance. this design prevents the output bus from being perturbed by the intermediate states of the sc operation (often a reset state for phi1 and settling to the valid state during phi2). following are the exceptions: 1) if the clockphase bit in cr0 (for the sc block in question) is set to 1, then the out- put is enabled for the whole of phi2. 2) if the shdis signal is set in bit 6 of the analog clock select register, then sam- ple and hold operation is disabled for all columns and all enabled outputs of sc blocks are connected to their respec- tive output busses for the entire period of their respective phi2s. this bit also affects the latching of the comparator output (cbus). both clock phases, phi1 and phi2, are involved in the output latching mechanism. the capture of the next value to be output from the latch (capture point event) hap- pens during the falling edge of one clock phase, and the ris- ing edge of the other clock phase will cause the value to come out (output point event). this bit determines which clock phase triggers the capture point event, and the other clock will trigger the output point event. the value output to the comparator bus will remain stable between output point events. bit 5: asign. this bit controls the switch phasing of the switches on the bottom plate of the a capacitor. the bottom plate samples the input or the reference. bits 4 to 0: acap[4:0]. the acap bits set the value of the capacitor in the a path. for additional information, reference the asdxxcr0 register on page 114 . 22.3.6 asdxxcr1 register bits 7, 6, and 5: amux[2:0]. these bits control the input muxing for the a capacitor branch. bits 4 to 0: bcap[4:0]. the bcap bits set the value of the capacitor in the b path. for additional information, reference the asdxxcr1 register on page 115 . 22.3.7 asdxxcr2 register bit 7: analogbus. this bit gates the output to the analog column bus. the output on the analog column bus is affected by the state of the clockphase bit in control 0 reg- ister (asd11cr0,). if analogbus is set to 0, the output to the analog column bus is tri-stated. if analogbus is set to 1, the clockphase bit selects the signal that is output to the ana- log-column bus. if the clockphase bit is 0, the block output is gated by sampling clock on last part of phi2. if the clock- phase bit is 1, the block clockphase continuously drives the analog column bus (abus). bit 6: compbus. this bit controls the output to the column comparator bus (cbus). note that if the comparator bus is not driven by anything in the column, it is pulled low. the comparator output is evaluated on the rising edge of internal phi1 and is latched so it is available during internal phi2. bit 5: autozero. this bit controls the shorting of the output to the inverting input of the opamp. when shorted, the opamp is basically a follower. the output is the opamp off- set. by using the feedback capacitor of the integrator, the
22. switched capacitor block cy8c22xxx preliminary data sheet 244 document no. 38-12009 rev. *d december 22, 2003 block can memorize the offset and create an offset cancella- tion scheme. autozero also controls a pair of switches between the a and b branches and the summing node of the opamp. if autozero is enabled, then the pair of switches is active. autozero also affects the function of the fsw1 bit in control 3 register. bits 4 to 0: ccap[4:0]. the ccap bits set the value of the capacitor in the c path. for additional information, reference the asdxxcr2 register on page 116 . 22.3.8 asdxxcr3 register bits 7 and 6: arefmux[1:0]. these bits select the refer- ence input of the a capacitor branch. bit 5: fsw1. this bit is used to control a switch in the inte- grator capacitor path. it connects the output of the opamp to the integrating cap. the state of the switch is affected by the state of the autozero bit in control 2 register (asd11cr2, ). if the fsw1 bit is set to 0, the switch is always disabled. if the fsw1 bit is set to 1, the autozero bit determines the state of the switch. if the autozero bit is 0, the switch is enabled at all times. if the autozero bit is 1, the switch is enabled only when the internal phi2 is high. bit 4: fsw0. this bit is used to control a switch in the inte- grator capacitor path. it connects the output of the opamp to analog ground. bit 3: bsw. this bit is used to control switching in the b branch. if disabled, the b capacitor branch is a continuous time branch like the c branch of the sc a block. if enabled, then on internal phi1, both ends of the cap are switched to analog ground. on internal phi2, one end is switched to the b input and the other end is switched to the summing node. bit 2: bmuxsd. this bit controls muxing to the input of the b capacitor branch. the b branch can be switched or unswitched. bits 1 and 0: pwr[1:0]. the power bits serve as encoding for selecting one of four power levels. the block always powers up in the off state. for additional information, reference the asdxxcr3 register on page 117 .
december 22, 2003 document no. 38-12009 rev. *d 245 23. continuous time block this chapter discusses the analog continuous time block and its associated registers. this block supports programmable gain or attenuation opamp circuits; instrumentation amplifiers, using two ct blocks (differential gain); continuous time high-frequency, anti-aliasing filters; and modest response-time analog comparators. 23.1 architectural description the analog continuous time blocks are built around a rail- to-rail, input and output, low offset and low noise opamp. there are several analog muxes controlled by register-bit settings in the control registers that determine the signal topology inside the block. there is also a precision resistor matrix located in the feedback path of the opamp and is con- trolled by register-bit settings. the block also contains a low power comparator, connected to the same inputs and outputs as the main amplifier. this comparator is useful for providing a digital compare output in low power sleep modes, when the main amplifier is powered off. there are three discrete outputs from this block. these out- puts connect to the following buses: 1. the analog output bus (abus), which is an analog bus resource that is shared by all of the analog blocks in the analog column for that block. this signal may also be routed externally through an output buffer. 2. the comparator bus (cbus), which is a digital bus that is a resource that is shared by all of the analog blocks in a column for that block. 3. the local output bus (out, gout and lout), which are routed to neighboring blocks. gout and lout refer to the gain/loss mode configura- tion of the block, and connect to gin/lin inputs of neigh- boring blocks. table 23-1. analog continuous time block registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access x,7xh acbxxcr3 lpcmpen cmout insamp exgain rw : 00 x,7xh acbxxcr0 rtapmux[3:0] gain rtopmux rbotmux[1:0] rw : 00 x,7xh acbxxcr1 analogbus compbus nmux[2:0] pmux[2:0] rw : 00 x,7xh acbxxcr2 cphase clatch compcap tmuxen testmux[1:0] pwr[1:0] rw : 00 legend x,: an ?x? before the comma in the address field indicates that the register exists in both register banks. x: an ?x? after the comma in the address field indicates that there are multiple instances of the register. for an expanded add ress listing of these registers, refer to the ?analog register summary? on page 221 .
23. continuous time block cy8c22xxx preliminary data sheet 246 document no. 38-12009 rev. *d december 22, 2003 figure 23-1. analog continuous time block diagram rbotmux block inputs block inputs pmux agnd agnd abus nmux refhi, reflo power compcap agnd scblk rtapmux gout lout gain resistor matrix port input gin lin fb abus analogbus out cbus gain testmux refhi agnd pmuxout reflo vdd rtopmux adjacent column rbotmux cmout vss - + lpcmpen latch cbus driver transparent, phi1 or phi2 insamp
december 22, 2003 document no. 38-12009 rev. *d 247 cy8c22xxx preliminary data sheet 23. continuous time block 23.2 register definitions 23.2.1 acbxxcr0 register bits 7 to 4: rtapmux[3:0]. these bits, in combination with the exgain bit, b0, of the cr3 register, control the center tap of the resistor string. bit 3: gain. this bit controls whether the resistor string is connected around the opamp as for gain (center tap to inverting opamp input) or for loss (center tap to output of the block). note that setting gain alone does not guarantee a gain or loss block. routing of the other ends of the resistor determine this. bit 2: rtopmux. this bit controls the top end of the resistor string, which can either be connected to vdd or to the opamp output. bits 1 and 0: rbotbux[1:0]. these bits, in combination with the insamp bit, b1, of the cr3 register, control the connection of the bottom end of the resistor string. for additional information, reference the acbxxcr0 register on page 107 . 23.2.2 acbxxcr1 register bit 7: analogbus. this bit controls the analog output bus. a cmos switch connects the opamp output to the analog bus. bit 6: compbus. this bit controls a tri-state buffer that drives the comparator logic. if no block in the analog column is driving the comparator bus, it will be driven low externally to the blocks. bits 5, 4, and 3: nmux[2:0]. these bits control the multi- plexing of inputs to the inverting input of the opamp. there are seven input choices from outside the block, plus an internal feedback selection. bits 2, 1, and 0: pmux[2:0]. these bits control the multi- plexing of inputs to the non-inverting input of the opamp. there are seven input choices from outside the block, plus an internal feedback selection. for additional information, reference the acbxxcr1 register on page 108 . 23.2.3 acbxxcr2 register bit 7: cphase. this bit controls which internal clock phase the comparator data is latched on. bit 6: clatch. this bit controls whether the latch is active or if it is always transparent. bit 5: compcap. this bit controls whether the compensa- tion capacitor is switched in or not in the opamp. by not switching in the compensation capacitance, a much faster response can be obtained, if the amplifier is being used as a comparator. bit 4: tmuxen. if the tmuxen bit is high, then the value of testmux[1:0] determines which testmux input is con- nected to the abus for that particular continuous time block. if the tmuxen bit is low, then none of the testmux inputs are connected to the abus regardless of the value of test- mux[1:0]. bits 3 and 2: textmux[1:0]. testmux selects block bypass mode. bits 1 and 0: pwr[1:0]. power is encoded to select 1 of 3 power levels or power down (off). the blocks power up in the off state. combined with the turbo mode, this provides 6 power levels. turbo mode is controlled by the hbe bit of the analog reference control register. for additional information, reference the acbxxcr2 register on page 109 . 23.2.4 acbxxcr3 register bits 7 to 4: reserved. bit 3: lpcmpen. each continuous time block has a low power comparator connected in parallel with the block?s main opamp/comparator. the low power comparator is used in situations where low power is more important than low noise, low offset, and high speed. the low power compara- tor operates when the lpcmpen bit is set high. since the main opamp/comparator?s output is connected to the low power comparator?s output, only one of the comparators should be active at a particular time. the main opamp/com- parator is powered down by setting acbxxcr2: pwr[1:0] to 00b, or setting arf_cr: pwr[2:0] to x00b. the low power comparator is unaffected by the pwr bits in acbxxcr2 and arf_cr.
23. continuous time block cy8c22xxx preliminary data sheet 248 document no. 38-12009 rev. *d december 22, 2003 bit 2: cmout. the analog array may be used to build two different forms of instrumentation amplifiers. two continuous time blocks combine to make a 2-opamp instrumentation amplifier (see figure 23-2 ). figure 23-2. 2-opamp instrumentation amplifier two continuous time blocks and one switched capacitor block combine to make a 3-opamp instrumentation amplifier (see figure 23-3 ). the 3-opamp instrumentation amplifier takes more resources, but handles a larger common mode input range. bit2 (cmout) and bit1 (insamp) control switches are involved in the 3-opamp instrumentation amplifier. if bit2 (cmout) is high, then the node formed by the connection of the resistors between the continuous time blocks is con- nected to that continuous time block?s abus. this node is the common mode of the inputs to the instrumentation amplifier. the cmout bit is optional for the 3-opamp instru- mentation amplifier. bit 1: insamp. this bit is used to connect the resistors of two continuous time blocks as part of a 3-opamp instrumen- tation amplifier. the insamp bit must be high for the 3- opamp instrumentation amplifier (see figure 23-3 ). figure 23-3. 3-opamp instrumentation amplifier non + - rb ra out inv + - ra rb 1 st ct block 2 nd ct block gain = 1+ r a r b non + - rb ra inv ra rb phi1 1st ct block 2nd ct block + - insamp 1st abus 2nd abus phi2 cmout insamp cmout phi2 phi1 + - phi1 phi1 phi2 out sc block type c or d cy cx cx gain = cx 1+ r a r b cy
december 22, 2003 document no. 38-12009 rev. *d 249 cy8c22xxx preliminary data sheet 23. continuous time block bit 0: exgain. the continuous time block?s resistor tap is specified by the value of acbxxcr3 exgain combined with the value of acbxxcr0 rtapmux[3:0]. for rtapmux values from 02h through 15h, the exgain bit has no effect on which tap is selected. see the acbxxcr0 register details. the exgain bit allows one additional tap selection for rtapmux = 01h and a second additional tap selection for rtapmux = 00h (see figure 23-4 ). for additional information, reference the acbxxcr3 register on page 106 . figure 23-4. continuous time block in gain configuration in rtapmux[3:0] exgain x fh x eh x dh 0 1h 0 0h 1 1h 1 0h out + - r r r r r r r r r r r r total number of unit resistors = 48
23. continuous time block cy8c22xxx preliminary data sheet 250 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 251 section f system resources the system resources section discusses the system resources that are available for the psoc device and the registers associated with those resources. this section encompasses the following chapters: digital clocks on page 253 decimator on page 259 i2c on page 261 por and lvd on page 277 internal voltage reference on page 279 system resets on page 281 top-level system resources architecture the figure below displays the top-level architecture of the psoc?s system resources. each component of the figure is dis- cussed at length in this section. psoc system resources block diagram system bus i 2 c internal voltage reference digital clocks por and lvd system resets decimator
section f system resources cy8c22xxx preliminary data sheet 252 document no. 38-12009 rev. *d december 22, 2003 system resources register summary the table below lists all the psoc registers that the system resources of the device and its individual blocks use. summary table of the system resource registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access digital clock registers 0,dah int_clr0 vc3 sleep gpio analog 1 v monitor rw : 00 0,e0h int_msk0 vc3 sleep gpio analog 1 v monitor rw : 00 1,deh osc_cr4 vc3 input select[1:0] rw : 00 1,dfh osc_cr3 vc3 divider[7:0] rw : 00 1,e0h osc_cr0 32k select pll mode no buzz sleep[1:0] cpu speed[2:0] rw : 00 1,e1h osc_cr1 vc1 divider[3:0] vc2 divider[3:0] rw : 00 1,e2h osc_cr2 pllgain extclken imodis sysclkx2 dis rw : 00 decimator registers 0,e4h dec_dh data high byte[7:0] rc : xx 0,e5h dec_dl data low byte[7:0] rc : xx 0,e6h dec_cr0 igen[3:0] iclks0 dcol[1:0] dclks0 rw : 00 0,e7h dec_cr1 ecnt idec iclks1 dclks1 rw : 00 i2c registers 0,d6h i2c_cfg pselect bus error ie stop ie clock rate enable master enable slave rw : 00 0,d7h i2c_scr bus error lost arb stop status ack address transmit lrb byte complete r : 00 0,d8h i2c_dr data[7:0] rw : 00 0,d9h i2c_mscr bus busy master mode restart gen start gen r : 00 por and lvd registers 1,e3h vlt_cr porlev[1:0] lvdtben vm[2:0] rw : 00 1,e4h vlt_cmp lvd ppor r : 00 internal voltage reference register 1,eah bdg_tr tc[1:0] v[3:0] rw:00 system reset registers 0,feh cpu_scr1 iramdis rw : 00 0,ffh cpu_scr0 gies wdrs pors sleep stop rw : xx legend c: cearable register or bits. x: the value for power on reset is unknown.
december 22, 2003 document no. 38-12009 rev. *d 253 24. digital clocks this chapter discusses the digital clocks and its associated registers. it serves as an overview of the clocking options avail- able in the psoc devices. for detailed information on specific oscillators, see the individual oscillator chapters in the secti on called ?core architecture? on page 31 . 24.1 architectural description the psoc m8c core has a large number of clock sources that increase the flexibility of the psoc mixed signal arrays, as illustrated in figure 24-1 . 24.1.1 internal main oscillator the internal main oscillator (imo) is the foundation upon which almost all other clock sources in the psoc mixed sig- nal arrays are based. the default mode of the imo creates a 24 mhz reference clock that is used by many other circuits in the chip. the imo may also be configured to operate in a pll mode where the oscillator is locked to a precision 32.768 khz crystal reference. the psoc device has an option to replace the imo with an externally supplied clock that will become the base for all of the clocks the imo nor- mally serves. whether the external clock or the internal main oscillator is selected, all chip functions are clocked from a derivative of sysclk or are re-synchronized to sysclk. all external asynchronous signals (through row inputs), as well as the selected 32k oscillator, are resynchronized to sysclk for use in the digital blocks. the imo is discussed in detail in the chapter ?internal main oscillator (imo)? on page 63 . figure 24-1. overview of psoc clock sources table 24-1. digital clocking registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access 0,dah int_clr0 vc3 sleep gpio analog 1 v monitor rw : 00 0,e0h int_msk0 vc3 sleep gpio analog 1 v monitor rw : 00 1,deh osc_cr4 vc3 input select[1:0] rw : 00 1,dfh osc_cr3 vc3 divider[7:0] rw : 00 1,e0h osc_cr0 32k select pll mode no buzz sleep[1:0] cpu speed[2:0] rw : 00 1,e1h osc_cr1 vc1 divider[3:0] vc2 divider[3:0] rw : 00 1,e2h osc_cr2 pllgain extclken imodis sysclkx2 dis rw : 00 sysclk sysclkx2 i32k x32k tclk 32k select tmode oscillator phase detector pll mode 24 mhz 48 mhz 32 khz cpu clk vc1 vc2 vc3 clk48en_ 24v3sel divider (24v2) divider (24v1) divider (cpu) divider (24v3)
24. digital clocks cy8c22xxx preliminary data sheet 254 document no. 38-12009 rev. *d december 22, 2003 24.1.2 internal low speed oscillator the internal low speed oscillator (ilo), or sometimes referred to as the sleep oscillator, is always on unless the device is operating off a crystal. the ilo is available as a general clock, but is also the clock source for the sleep and watchdog timers. the ilo is discussed in detail in the chapter ?internal low speed oscillator (ilo)? on page 65 . 24.1.3 32 khz crystal oscillator the psoc may be configured to use an external crystal. when configured in this way the internal low speed oscillator is turned off and the crystal becomes the clock source for all 32 khz clocks. the crystal oscillator is discussed in detail in the chapter ?32 khz crystal oscillator (eco)? on page 67 . 24.1.4 external clock the ability to replace the 24 mhz internal main oscillator (imo), as the device master system clock (sysclk) with an externally supplied clock, is a feature in the psoc mixed sig- nal arrays. pin p1[4] has been chosen as the input pin for the external clock. this pin was chosen because it is not associated with any special features such as analog io, crystal, or in sys- tem serial programming (issp), and it is also not physically close to either the p1[0] and p1[1] crystal pins. the user is able to supply an external clock with a frequency between 1 mhz and 24 mhz. the reset state of the ext- clken bit is ?0?, and therefore, the device always boots up under control of the imo. there is no way to start the system from a reset state with the external clock. when the extclken bit is set, the external clock becomes the source for the internal clock tree, sysclk, which drives most chip clocking functions. all external and internal sig- nals, including the 32 khz clock, whether derived from the internal low speed oscillator (ilo) or the crystal oscillator, are synchronized to this clock source. 24.1.4.1 clock doubler one of the blocks driven by the system clock is the clock doubler circuit that drives the sysclkx2 output. this dou- bled clock, which is 48 mhz when the imo is the selected clock, may be used as a clock source for the digital blocks. when the external clock is selected, the sysclkx2 signal is still available and serves as a doubler for whatever fre- quency is input on the external clock pin. following the spec for the external clock input ensures that the internal circuitry of the digital blocks, which is clocked by sysclkx2, will meet timing. however, since the doubled clock is generated from both edges of the input clock, clock jitter will be introduced if the duty cycle deviates greatly from fifty percent. also, the high time of the clock out of the dou- bler is fixed at 21 ns, so the duty cycle of sysclkx2 will be proportional to the inverse of the frequency, as shown in figure 24-2 . regardless of the input frequency, the high period of sysclkx2 is 21 ns nominal. figure 24-2. operation of the clock doubler 24.1.4.2 switch operation switching between the imo and the external clock may be done in firmware at any time and is transparent to the user. since all chip resources run on clocks derived from or syn- chronized to sysclk, when the switch is made, analog and digital functions may be momentarily interrupted. when a switch is made from the imo to the external clock, the imo may be turned off to save power. this can be done by setting the imodis bit and may be done immediately after the instruction that sets the extclken bit. however, when switching back from an external clock to the imo, the imodis bit must be cleared, and a firmware delay imple- mented. this gives the imo sufficient start-up time before the extclken bit may be cleared. switch timing depends on whether the cpu clock divider is set for divide by 1, or divide by 2 or greater. in the case where the cpu clock divider is set for divide by 2 or greater, as shown in figure 24-3 , the setting of the extclken bit occurs shortly after the rising edge of sysclk. the sysclk output is then disabled after the next falling edge of sysclk, but before the next rising edge. this ensures a glitch free transition and provides a full cycle of setup time from sysclk to output disable. once the current clock selection is disabled, the enable of the newly selected clock is double synchronized to that clock. after synchronization, on the subsequent negative edge, sysclk is enabled to output the newly selected clock. in the 24 mhz case, as shown in figure 24-4 , the assertion of iow_ and thus the setting of the extclken bit occurs on the falling edge of sysclk. since sysclk is already low, the output is immediately disabled and therefore, the setup time from sysclk to disable is one-half sysclk. extenal clock sysclkx2 21 ns nominal
december 22, 2003 document no. 38-12009 rev. *d 255 cy8c22xxx preliminary data sheet 24. digital clocks figure 24-3. switch from imo to the external clock with a cpu clock divider of two or greater figure 24-4. switch from imo to external clock with the cpu running with a cpu clock divider of one cpuclk imo extenal clock sysclk iow_ extclk bit imo is disabled. external clock is enabled. cpuclk imo external clock sysclk iow extclk imo is disabled external clock is enabled
24. digital clocks cy8c22xxx preliminary data sheet 256 document no. 38-12009 rev. *d december 22, 2003 24.2 register definitions 24.2.1 int_clr0 register the int_clr0 register holds bits that are used by several different resources. the digital clocks only use bit 7 of the int_clr0 register for the vc3 clock and bits zero through six are used by other resources. for a full discussion of the int_clr0 register, see the int_clrx register in the inter- rupt controller chapter. for additional information, reference the int_clr0 register on page 129 . 24.2.2 int_msk0 register the int_msk0 register holds bits that are used by several different resources. the digital clocks only use bit 7 of the int_msk0 register for the vc3 clock and bits zero through six are used by other resources. the sleep bit (bit 6) con- trols whether the sleep timer may be used as an interrupt source. for a full discussion of the int_msk0 register, see the int_mskx register in the interrupt controller chapter. for additional information, reference the int_msk0 register on page 134 . 24.2.3 osc_cr0 register bit 7: 32k select. by default, the 32 khz clock source is the internal low-speed oscillator (ilo). optionally, the external crystal oscillator (eco) may be selected. bit 6: pll mode. this bit, in the osc_cr0 register, is the only bit that directly influences the pll. when set, this bit enables the pll. the extclk bit should be set low during pll operation. bit 5: no buzz. normally, when the sleep bit is set in the cpu_scr register, all chip systems are powered down, including the band gap reference. however, to facilitate the detection of por and lvd events at a rate higher than the sleep interval, the band gap circuit is powered up periodi- cally for about 60 us at the sleep system duty cycle (set in eco_tr), which is independent of the sleep interval and typically higher. when the no buzz bit is set, the sleep sys- tem duty cycle value is overridden, and the band gap cir- cuit is forced to be on during sleep. this results in faster response to an lvd or por event (continuous detection as opposed to periodic), at the expense of slightly higher aver- age sleep current. bits 4 and 3: sleep[1:0]. the available sleep interval selections are shown in table 24-2 . it must be remembered that when the ilo is the selected 32 khz clock source, sleep intervals are approximate. bits 2, 1, and 0: cpu speed[2:0]. the psoc m8c may operate over a range of cpu clock speeds ( table 24-3 ), allowing the m8c?s performance and power requirements to be tailored to the application. the reset value for the cpu speed bits is zero. therefore, the default cpu speed is one-eighth of the clock source. the internal main oscillator is the default clock source for the cpu speed circuit; therefore, the default cpu speed is 3 mhz. see ?external clock? on page 254 for more informa- tion on the supported frequencies for externally supplied clocks. the cpu frequency is changed with a write to the osc_cr0 register. there are eight frequencies generated from a power-of-2 divide circuit, which are selected by a 3- bit code. at any given time, the cpu 8:1 clock multiplexer is selecting one of the available frequencies, which is re-syn- chronized to the 24 mhz master clock at the output. regardless of the cpu speed bit?s setting, if the actual cpu speed is greater than 12 mhz, the 24 mhz operating requirements apply. an example of this scenario is a device that is configured to use an external clock, which is supply- ing a frequency of 20 mhz. if the cpu speed register?s value is 0b011, the cpu clock will be 20 mhz. therefore, the supply voltage requirements for the device are the same as if the part was operating at 24 mhz off of the internal main oscillator. the operating voltage requirements are not relaxed until the cpu speed is at 12.0 mhz or less. for additional information, reference the osc_cr0 register on page 165 . table 24-2. sleep interval selections sleep interval osc_cr[4:3] sleep timer clocks sleep period (nominal) watchdog period (nominal) 00b (default) 64 1.95 ms 6 ms 01b 512 15.6 ms 47 ms 10b 4096 125 ms 375 ms 11b 32,768 1 sec 3 sec table 24-3. osc_cr0[2:0] bits: cpu speed divider source clock bits internal main oscillator external clock 000b 3 mhz extclk/ 8 001b 6 mhz extclk/ 4 010b 12 mhz extclk/ 2 011b 24 mhz extclk/ 1 100b 1.5 mhz extclk/ 16 101b 750 khz extclk/ 32 110b 187.5 khz extclk/ 128 111b 93.7 khz extclk/ 256
december 22, 2003 document no. 38-12009 rev. *d 257 cy8c22xxx preliminary data sheet 24. digital clocks 24.2.4 osc_cr1 register bits 7 to 4: vc1 divider[3:0]. the vc1 clock net is one of the variable clock nets available in the psoc m8c. the source for the vc1 clock net is a simple 4-bit divider. the source for the divider is 24 mhz system clock; however, if the device is configured to use an external clock, the input to the divider will be the external clock. therefore, the vc1 clock net is not always the result of dividing down a 24 mhz clock. the 4-bit divider that controls the vc1 clock net may be configured to divide, using any integer value between 1 and 16. table 24-4 lists all values for the vc1 clock net. bits 3 to 0: vc2 divider[3:0]. the vc2 clock net is one of the variable clock nets available in the psoc m8c. the source for the vc2 clock net is a simple 4-bit divider. the source for the divider is the vc1 clock net. the 4-bit divider that controls the vc2 clock net may be configured to divide, using any integer value between 1 and 16. tab le 2 4- 5 lists all values for the vc2 clock net. for additional information, reference the osc_cr1 register on page 166 . 24.2.5 osc_cr2 register bit 7: pllgain. this is the only bit in the osc_cr2 regis- ter that directly influences the pll. when set, this bit keeps the pll in a low gain mode. bits 6 to 3: reserved. bit 2: extclken. when the extclken bit is set, the external clock becomes the source for the internal clock tree, sysclk, which drives most chip clocking functions. all external and internal signals, including the 32 khz clock, whether derived from the internal low speed oscillator (ilo) or the crystal oscillator, are synchronized to this clock source. if an external clock is enabled, pll mode should be off. bit 1: imodis. when set, the internal main oscillator is dis- abled. if the doubler is enabled (sysclkx2dis=0), the internal main oscillator will be forced on. bit 0: sysclkx2dis. when set, the internal main oscilla- tor?s doubler is disabled. this will result in a reduction of overall device power, on the order of 1 ma. it is advised that any application that does not require this doubled clock should have it turned off. for additional information, reference the osc_cr2 register on page 167 . table 24-4. osc_cr1[7:4] bits: vc1 divider value divider source clock bits internal main oscillator external clock 0h 24 mhz extclk / 1 1h 12 mhz extclk / 2 2h 8 mhz extclk / 3 3h 6 mhz extclk / 4 4h 4.8 mhz extclk / 5 5h 4 mhz extclk / 6 6h 3.43 mhz extclk / 7 7h 3 mhz extclk / 8 8h 2.67 mhz extclk / 9 9h 2.40 mhz extclk / 10 ah 2.18 mhz extclk / 11 bh 2.00 mhz extclk / 12 ch 1.85 mhz extclk / 13 dh 1.71 mhz extclk / 14 eh 1.6 mhz extclk / 15 fh 1.5 mhz extclk / 16 table 24-5. osc_cr1[3:0] bits: vc2 divider value divider source clock bits internal main oscillator external clock 0h (24 / (osc_cr1[7:4]+1)) / 1 (extclk / (osc_cr1[7:4]+1)) / 1 1h (24 / (osc_cr1[7:4]+1)) / 2 (extclk / (osc_cr1[7:4]+1)) / 2 2h (24 / (osc_cr1[7:4]+1)) / 3 (extclk / (osc_cr1[7:4]+1)) / 3 3h (24 / (osc_cr1[7:4]+1)) / 4 (extclk / (osc_cr1[7:4]+1)) / 4 4h (24 / (osc_cr1[7:4]+1)) / 5 (extclk / (osc_cr1[7:4]+1)) / 5 5h (24 / (osc_cr1[7:4]+1)) / 6 (extclk / (osc_cr1[7:4]+1)) / 6 6h (24 / (osc_cr1[7:4]+1)) / 7 (extclk / (osc_cr1[7:4]+1)) / 7 7h (24 / (osc_cr1[7:4]+1)) / 8 (extclk / (osc_cr1[7:4]+1)) / 8 8h (24 / (osc_cr1[7:4]+1)) / 9 (extclk / (osc_cr1[7:4]+1)) / 9 9h (24 / (osc_cr1[7:4]+1)) / 10 (extclk / (osc_cr1[7:4]+1)) / 10 ah (24 / (osc_cr1[7:4]+1)) / 11 (extclk / (osc_cr1[7:4]+1)) / 11 bh (24 / (osc_cr1[7:4]+1)) / 12 (extclk / (osc_cr1[7:4]+1)) / 12 ch (24 / (osc_cr1[7:4]+1)) / 13 (extclk / (osc_cr1[7:4]+1)) / 13 dh (24 / (osc_cr1[7:4]+1)) / 14 (extclk / (osc_cr1[7:4]+1)) / 14 eh (24 / (osc_cr1[7:4]+1)) / 15 (extclk / (osc_cr1[7:4]+1)) / 15 fh (24 / (osc_cr1[7:4]+1)) / 16 (extclk / (osc_cr1[7:4]+1)) / 16
24. digital clocks cy8c22xxx preliminary data sheet 258 document no. 38-12009 rev. *d december 22, 2003 24.2.6 osc_cr3 register bits 7 to 0: vc3 divider[7:0]. as an example of the flexi- bility of the clocking structure in psoc devices, consider a device that is running off of an externally supplied clock at a frequency of 93.7 khz. this clock value may be divided by the vc1 divider to achieve a vc1 clock net frequency of 5.89 khz. the vc2 divider could reduce the frequency by another factor of 16, resulting in a vc2 clock net frequency of 366.02 hz. finally, the vc3 divider may choose vc2 as its input clock and divide by 256, resulting in a vc3 clock net frequency of 1.43 hz. as mentioned previously the vc3 clock net can generate a system interrupt. once the input clock and the divider value for the vc3 clock are chosen, only one additional step is needed to enable the interrupt; the vc3 mask bit needs to be set in register int_msk0[7]. once the vc3 mask bit is set, the vc3 clock generates pending interrupts every num- ber of clock periods equal to the vc3 divider register value plus one. therefore, if the vc3 divider register?s value is 05h (divide by 6), an interrupt would occur every six periods of the vc3?s input clock. another example would be if the divider value was 00h (divide by 1), an interrupt would be generated on every period of the vc3 clock. the vc3 mask bit only controls the ability of a posted interrupt to become pending. because there is no enable for the vc3 interrupt, vc3 interrupts will always be posting. see the interrupt con- troller chapter for more information on posting and pending. for additional information, reference the osc_cr3 register on page 164 . 24.2.7 osc_cr4 register bits 7 to 2: reserved. bits 1 and 0: vc3 input select [1:0]. the vc3 clock net is the only clock net with the ability to generate an interrupt. the vc3 is most similar to the vc2 in that its input clock comes from a configurable source. as shown in figure 24-1 on page 253 , a 4-to-1 multiplexer determines the clock that will be used as in the input to the vc3 divider. the multi- plexer allows either the 48 mhz, 24 mhz, vc1, or vc2 clocks to be used as the input clock to the divider. because the selection of a clock for the vc3 divider is performed by a simple 4-to-1 mux, runt pulses and glitches may be injected to the vc3 divider when the osc_cr4[1:0] bits are changed. care should be taken to ensure that blocks using the vc3 clock are either disabled when osc_cr4[1:0] is changed or not sensitive to glitches. unlike the vc1 and vc2 clock dividers, the vc3 clock divider is 8-bits wide. therefore, there are 256 valid divider values as indicated by tab l e 2 4- 6 . it is important to remember that even though the vc3 divider has four choices for input clock, none of the choices have fixed frequencies for all device configurations. both the 24 mhz and 48 mhz clocks may have very different frequen- cies, if an external clock is in use. also, the divider values for the vc1 and vc2 inputs to the multiplexer must be consid- ered. for additional information, reference the osc_cr4 register on page 163 table 24-6. osc_cr3[7:0] bits: vc3 divider value divider source clock bits sysclkx2 sysclk vc1 vc2 00h sysclkx2 sysclk vc1 vc2 01h sysclkx2 / 2 sysclk / 2 vc1 / 2 vc2 / 2 02h sysclkx2 / 3 sysclk / 3 vc1 / 3 vc2 / 3 03h sysclkx2 / 4 sysclk / 4 vc1 / 4 vc2 / 4 ... ... ... ... ... fch sysclkx2 / 253 sysclk / 253 vc1 / 253 vc2 / 253 fdh sysclkx2 / 254 sysclk / 254 vc1 / 254 vc2 / 254 feh sysclkx2 / 255 sysclk / 255 vc1 / 255 vc2 / 255 ffh sysclkx2 / 256 sysclk / 256 vc1 / 256 vc2 / 256 table 24-7. osc_cr4[1:0] bits: vc3 bits multiplexer output 00b sysclk 01b vc1 10b vc2 11b sysclkx2
december 22, 2003 document no. 38-12009 rev. *d 259 25. decimator this chapter briefly explains the psoc decimator and its associated registers. it serves as an overview of the clocking options available in the psoc devices. the decimator block is a hardware assist for digital signal processing applications. the decimator may be used for sigma-delta analog to digital converters and incremental analog to digital converters. 25.1 architectural description the decimator may perform either a single or double inte- gration of the discrete-time, discrete-amplitude signal applied to the data input pin of the block. the integrated value may be up to 16-bits long and is read or cleared by way of a register interface. because the data input to the decimator is only one bit, the input signal's amplitude can only be one of two values: because the input signal is a discrete-time signal, the weight of each encoding is analogous to the area under the signal for that instant in time. therefore, to integrate the signal, the sum of the weights needs to be calculated over a period of time. when the decimator is configured as a single integra- tor this is exactly what happens. for each period of the input clock the current area (integral value) is either increased by one (weight = +1, encoding = 1) or decreased by one (weight = -1, encoding = 0). 25.2 register definitions 25.2.1 dec_dh register the decimator data high register (dec_dh) is a dual pur- pose register. when the register is read the most significant byte of the 16-bit decimator value is returned. depending on how the decimator is configured, this value is either the result of the second integration or the high byte of the 16-bit counter. the second function of the dec_dh register is activated whenever the register is written: that function is to clear the decimator value. when the dec_dh register is written, the decimator's value will be cleared regardless of the value written. either the dec_dh or dec_dl register may be written to clear the decimator's value. note that this register does not reset to 00h. the dec_dh register resets to an indeterminate value. for additional information, reference the dec_dh register on page 138 . table 25-1. decimator registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access 0,e4h dec_dh data high byte[7:0] rc : xx 0,e5h dec_dl data low byte[7:0] rc : xx 0,e6h dec_cr0 igen[3:0] iclks0 dcol[1:0] dclks0 rw : 00 0,e7h dec_cr1 ecnt idec iclks1 dclks1 rw : 00 legend c: cearable register or bits. x: the value for power on reset is unknown. encoding weight 0-1 1+1
25. decimator cy8c22xxx preliminary data sheet 260 document no. 38-12009 rev. *d december 22, 2003 25.2.2 dec_dl register the decimator data low register (dec_dl) is a dual pur- pose register. when the register is read the least significant byte of the 16-bit decimator value is returned. depending on how the decimator is configured, this value is either the result of the second integration or the lower byte of the 16- bit counter. the second function of the dec_dl register is activated when ever the register is written: that function is to clear the decimator value. when the dec_dl register is written the decimator's value will be cleared regardless of the value written. either the dec_dl or dec_dh register may be written to clear the decimator's value. note that this register does not reset to 00h. the dec_dl register resets to an indeterminate value. for additional information, reference the dec_dl register on page 139 . 25.2.3 dec_cr0 register this register contains control bits to access hardware sup- port for both the incremental adc and the delisg adc. for incremental support, the upper four bits, igen[3:0], select which column comparator bit will be gated by the out- put of a digital block. the output of that digital block is typi- cally a pwm signal; the high time of which corresponds to the adc conversion period. this ensures that the compara- tor output is only processed for the precise conversion time. the digital block selected for the gating function is controlled by iclks0 in this register and iclks1 in dec_cr1. up to one of 16 digital blocks may be selected, depending on your specific chip resources. the delsig adc uses the hardware decimator to do a por- tion of the post processing computation on the comparator signal. dcol[1:0] selects the column source for the decima- tor data (comparator bit) and clock input (phi clocks). in addition, the decimator requires a timer signal to sample the current decimator value to an output register that may subsequently be read by the cpu. this timer period is set to be a function of the delsig conversion time and may be selected from up to one of 16 digital blocks (depending on your specific chip resources) with bit dclks0 and dclks1 in dec_cr1. for additional information, reference the dec_cr0 register on page 140 . 25.2.4 dec_cr1 register bit 7: ecnt. the ecnt bit is a mode bit that controls the operation of the decimator hardware block. by default, the decimator is set to a double integrate function, for use in hardware delsig processing. when the ecnt bit is set, the decimator block converts to a single integrate function. this gives the equivalent of a 16-bit counter suitable for use in hardware support for an incremental adc function. bit 6: idec. any function using the decimator requires a digital block timer to sample the current decimator value. normally, the positive edge of this signal will cause the deci- mator output to be sampled. however, when the idec bit is set, the negative edge of the selected digital block input will cause the decimator value to be sampled. bits 5 and 4: reserved. bit 3: iclks1. the iclks1 bit in this register selects the digital block sources for incremental and delsign adc hardware support (see the dec_cr0 register). bits 2 and 1: reserved. bit 0: dclks1. the dclks1 bit in this register selects the digital block sources for incremental and delsign adc hardware support (see the dec_cr0 register). for additional information, reference the dec_cr1 register on page 141 .
december 22, 2003 document no. 38-12009 rev. *d 261 26. i 2 c this chapter explains the i2c block and its associated registers. the i2c communications block is a serial processor designed to implement a complete i2c slave and/or master. the i2c communications block is a serial to parallel proces- sor designed to interface to the two-wire i2c serial commu- nications bus. the block provides i2c specific support for status detection and generation of framing bits, to eliminate the need for excessive host processor intervention and overhead. the i2c block will directly control the data (sda) and clock (scl) signals to the external i2c interface, through connec- tions to two dedicated gpio pins. the host firmware will interact with the block through io register reads and writes, and firmware synchronization will be implemented through polling and/or interrupts. functionality requirements include: master/slave, transmitter/receiver operation byte processing for low cpu overhead interrupt or polling cpu interface master clock rates: 50k, 100k, 400k multi-master clock synchronization multi-master mode arbitration support 7- or 10-bit addressing (through firmware support) smbus operation (through firmware support) hardware functionality provides basic i2c control, data, and status primitives. a combination of hardware support and firmware command sequencing provides a high degree of flexibility for implementing the required i2c functionality. hardware limitations: 1. there is no hardware support for automatic address comparison. when slave mode is enabled, every slave address will cause the block to interrupt the host and possibly stall the bus. 2. since receive and transmitted data is not buffered, there is no support for automatic receive acknowledge. the host processor must intervene at the boundary of each byte and either send a byte or ack received bytes. 26.1 architectural description the i2c block is designed to support a set of primitive oper- ations and detect a set of status conditions specific to the i2c protocol. these primitive operations and conditions are manipulated and combined at the firmware level to support the required data transfer modes. the host will set up con- trol options and issue commands to the unit through io writes and obtain status through io reads and interrupts. the block operates as either a slave, a master, or both. when enabled in slave mode, the unit is always listening for a start condition, or sending or receiving data. master mode can work in conjunction with slave mode. the master sup- plies the ability to generate the start or stop condition and determine if other masters are on the bus. for multi master mode, clock synchronization is supported. if master mode is enabled and slave mode is not enabled, the block does not generate interrupts on externally generated start conditions. 26.1.1 basic i2c data transfer figure 26-1 shows the basic form of data transfers on the i2c bus with a 7-bit address format. (for a more detailed description, see the i2c specification, version 2.1, by phil- lips semiconductor). table 26-1. i2c registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access 0,d6h i2c_cfg pselect bus error ie stop ie clock rate enable master enable slave rw : 00 0,d7h i2c_scr bus error lost arb stop status ack address transmit lrb byte complete r : 00 0,d8h i2c_dr data[7:0] rw : 00 0,d9h i2c_mscr bus busy master mode restart gen start gen r : 00
26. i2c cy8c22xxx preliminary data sheet 262 document no. 38-12009 rev. *d december 22, 2003 a start condition (generated by the master) is followed by a data byte, consisting of a 7-bit slave address (there is also a 10-bit address mode) and a r/w bit. the r/w bit sets the direction of data transfer. the addressed slave is required to acknowledge (ack) the bus by pulling the data line low dur- ing the 9 th bit time. if the ack is received, the transfer may proceed and the master can transmit or receive an indeter- minate number of bytes, depending on the r/w direction. if the slave does not respond with an ack for any reason, a stop condition is generated by the master to terminate the transfer or a restart condition may be generated for retry attempt. figure 26-1. basic i2c data transfer with 7-bit address format 178 9 178 9 start 7-bit address r/w ack 8-bit data ack/ nack stop
december 22, 2003 document no. 38-12009 rev. *d 263 cy8c22xxx preliminary data sheet 26. i2c 26.2 application description 26.2.1 slave operation assuming slave mode is enabled, it is continually listening on the bus for a start condition. when detected, the trans- mitted address/r/w byte is received and read from the unit by firmware. at the point where eight bits of the address has been received, a byte complete interrupt is generated. on the following low of the clock, the bus is stalled by holding the scl line low, until the host has had a chance to read the address byte and compare it to its own address. it will issue an ack or nack command based on that comparison. if there is an address match, the r/w bit determines how the host will sequence the data transfer in slave mode as shown in the two branches of figure 26-2 . i2c handshaking methodology (slave holds the scl line low to ?stall? the bus) will be used as necessary, to give the host time to respond to the events and conditions on the bus. figure 26-2 is a graphical representation of a typical data transfer from the slave perspective. figure 26-2. slave operation 178 178 9 start 7-bit address r/w ack 8-bit data ack/ nack stop shifter host reads the received byte from the i2c_dr register and checks for ?own address? and r/w. 178 8-bit data stop shifter host writes the byte to transmit to the i2c_dr register. 9 shifter r ( t x ) w ( r x ) host writes (ack) to i2c_scr register. slave transmitter/reciever ack/ nack host issues ack/ nack command with a write to the i2c_scr register. master may transmit another byte or stop. host reads the received byte from the i2c_dr register. ack = master wants to read another byte. nack = master says end-of-data nack = slave says no more ack = ok to receive more a byte interrupt is generated. the scl line is held low. an interrupt is generated on byte complete. the scl line is held low. an interrupt is generated on a complete byte + ack/nack. the scl line is held low. ack host writes (ack | transmit) to i2c_scr register. 9 host writes a new byte to the i2c_dr register and then writes a transmit command to i2c_scr to release the bus.
26. i2c cy8c22xxx preliminary data sheet 264 document no. 38-12009 rev. *d december 22, 2003 26.2.2 master operation to prepare for a master mode transaction, the host must determine if the bus is free. this can be done by polling the busbusy status. if busy, interrupts can be enabled to detect a stop condition. once it is determined that the bus is available, firmware should write the address byte into the i2c_dr register and set the start gen bit in the i2c_mscr register. if the slave sub-unit is not enabled, the block is in master only mode. in this mode, the unit does not generate inter- rupts or stall the bus on externally generated start condi- tions. in a multi-master environment there are two additional out- comes possible: 1. the host was too late to reserve the bus as a master and another master may have generated a start and sent an address/r/w byte. in this case, the unit as a master will fail to generate a start and will be forced into slave mode. the start will be pending and eventually occur at a later time when the bus becomes free. when the inter- rupt occurs in slave mode, the host can determine that the start command was unsuccessful by reading the i2c_mscr register start bit, which will be reset on suc- cessful start from this unit as master. if this bit is still a ?1? on the start/address interrupt, it means that the unit is operating in slave mode. in this case, the data register will have the master?s address data. 2. if another master starts a transmission at the same time as this unit, arbitration will occur. if this unit loses the arbitration, the lostarb status bit will be set. in this case, the block will release the bus and switch to slave opera- tion. when the start/address interrupt occurs, the data register will have the winning master?s address data. figure 26-3 is a graphical representation of a typical data transfer from the master perspective. figure 26-3. master operation 178 178 9 start 7-bit address r/w 8-bit data ack/ nack stop a start/address compete interrupt is generated. the scl line is held low. 178 8-bit data stop shifter host writes a byte to transmit i2c_dr register. 9 shifter r e a d ( r x ) w r i t e ( t x ) host issues a command to the i2c_scr register. master transmitter/receiver ack/ nack host issues transmit command to the i2c_scr register. host issues ack/ nack command to the i2c_scr register. host reads the received byte from i2c_dr register. ack = slave say ok to receive more. nack = slave says no more. nack = host master indicates end-of-data ack = host master wants more shifter host writes address byte to the i2c_dr register. host issues generate start command to i2c_mcr. an interrupt is generated on completed reception of the byte. the scl line is held low. host issues stop command master wants to send more bytes. an interrupt is generated on complettion of the byte + ack/nack. the scl line is held low. 9 ack
december 22, 2003 document no. 38-12009 rev. *d 265 cy8c22xxx preliminary data sheet 26. i2c 26.3 register definitions the i2c block contains four registers, all of which reside in user io space: configuration register (i2c_cfg), status and control register (i2c_scr), master status and control register (i2c_mscr), and data register (i2c_dr). the configuration register is used to set the basic operating modes, baud rate, and selection of interrupts. the status and control register is used by both master and slave to control the flow of data bytes and to keep track of the bus state during a transfer. data and address bytes are written to and read from the data register. the master status and control register implements i2c framing controls and pro- vides bus busy status. 26.3.1 i2c_cfg register this register is the i2c configuration register and contains the configuration bits for both master and slave mode oper- ation. these bits control baud rate selection and optional interrupts. these values are typically set once for a given configuration. the bits in this register are all r/w. bit 7: reserved. bit 6: pselect. with the default value of zero, the i2c pins are p1[7] for clock and p1[5] for data. when this bit is set, the pins for i2c switch to p1[1] for clock and p1[0] for data. this bit may not be changed while either the enable master or enable slave bits are set. however, the pselect bit may be set at the same time as the enable bits. the two sets of pins i2c may be used on are not equivalent. the default set, p1[7] and p1[5], are the preferred set. the alternate set, p1[1] and p1[0], are provided so that i2c may be used with 8-pin psoc parts. if in-circuit system serial programming (issp) is to be used and the alternate i2c pin set is also used, it is necessary to take into account the interaction between the psoc test controller and the i2c bus. the interface requirements for issp should be reviewed to ensure that they are not vio- lated. even if issp is not going to be used, pins p1[1] and p1[0] will respond differently to a por or xres event than other io pins. after an xres, event both pins will be pulled down to the ground by going into the resistive zero drive mode before reaching the high-z drive mode. after a por event, p1[0] will drive out a one, then go to the resistive zero state for some time, and finally reach the high-z drive mode state. after por, p1[1] will go into a resistive zero state for a while before going to the high-z drive mode. another issue with selecting the alternate i2c pins set is that these pins are also the crystal pins. therefore, a crystal may not be used when the alternate i2c pin set is selected. bit 5: bus error ie (interrupt enable). this bit controls whether the detection of a bus error will generate an inter- rupt. a bus error is typically a misplaced start or stop. see the bus error status bit description for a definition. this is an important interrupt with regards to master opera- tion. when there is a misplaced start or stop on the i2c bus all slave devices (including this device, if slave mode is enabled) will reset the bus interface and synchronize to this signal. however, when the hardware detects a bus error in master mode operation, the device will release the bus and transition to an idle state. in this case, a master operation in progress will never have any further status or interrupts associated with it and therefore the master may not be able to determine the status of that transaction. an immediate bus error interrupt will inform the master that this transfer did not succeed. bit 4: stop ie (interrupt enable). when this bit is set, a master or slave can interrupt on stop detection. the status bit associated with this interrupt is the stop status bit in the slave status and control register. when the stop status bit transitions from ?0? to ?1?, the interrupt is generated. it is important to note that the stop status bit is not automatically cleared. therefore, if it is already set, no new interrupts will be generated until it is cleared by firmware and a subse- quent stop condition is generated. bits 3 and 2: clock rate. the clock rate bits offer a selection of four sampling and bit rates. all block clocking is based on the sysclk input, which is nominally 24 mhz. the sampling rate and the baud rate are determined as fol- lows: sample rate = sysclk/pre-scale factor baud rate = 1/(sample rate x samples per bit) table 26-2. i2c_cfg configuration register bit access description mode 0 r/w enable slave ?0? = disabled ?1? = enabled master/ slave 1 r/w enable master ?0? = disabled ?1? = enabled master/ slave 3:2 r/w clock rate 00 = 100k, standard mode 01 = 400k fast mode 10 = 50k standard mode 11 = reserved master/ slave 4 r/w stop ie stop interrupt enable. 0 = disabled. 1 = enabled. an interrupt is generated on the detection of a stop condition. master only 5 r/w bus error ie stop interrupt enable. 0 = disabled. 1 = enabled. an interrupt is generated on the detection of a bus error. master/ slave 6 r/w i2c pin select 0 = p1[7], p1[5] 1 = p1[1], p1[0] master/ slave
26. i2c cy8c22xxx preliminary data sheet 266 document no. 38-12009 rev. *d december 22, 2003 the nominal values, when using the internal 24 mhz oscilla- tor, are shown in tab le 2 6- 3 . when clocking the input with a frequency other than 24 mhz (e.g., clocking the psoc chip with an external clock), the baud rates and sampling rates will scale accordingly. whether the block will work in a standard mode or fast mode system depends on the sample rate. the sample rate must be sufficient to resolve bus events, such as start and stop conditions. (see the i2c specification, version 2.1, by phillips semiconductor, for minimum start and stop hold times.) bit 1: enable master. when this bit is set, the master sta- tus and control register is enabled (otherwise it is held in reset) and i2c transfers can be initiated in master mode. when the master is enabled and operating, the block will clock the i2c bus at one of four baud rates, defined in the clock rate register. when operating in master mode, the hardware is multi-master capable, implementing both clock synchronization and arbitration. if the slave enable bit is not set, the block will operate in master only mode. all external start conditions will be ignored (although the bus busy sta- tus bit will still keep track of bus activity). block enable will be synchronized to the sysclk clock input ( see ?timing diagrams? on page 270 ). bit 0: enable slave. when the slave is enabled, the block generates an interrupt on any start condition and an address byte that it receives, which indicates the beginning of an i2c transfer. when operating as a slave, the block is clocked from an external master and therefore, will work at any frequency up to the maximum defined by the currently selected clock rate. the internal clock is only used in slave mode to ensure that there is adequate setup time from data output to the next clock on the release of a slave stall. when the enable slave and enable master bits are both ?0?, the block is held in reset and all status is cleared. see figure 26-4 for a description of the interaction between the master/slave enable bits. block enable will be synchronized to the sysclk clock input ( see ?timing diagrams? on page 270 ). for additional information, reference the i2c_cfg register on page 125 . table 26-3. i2c clock rates clock rate [1:0] i2c mode sysclk pre-scale factor samples per bit internal sampling freq./period (24 mhz) master baud rate (nominal) start/stop hold time (8 clocks) 00b standard /16 16 1.5 mhz/667 ns 93.75 khz 5.3 us 01b fast /4 16 6 mhz/167 ns 375 khz 1.33 us 10b standard /16 32 1.5 mhz/667 ns 46.8 khz 10.7 us 11b reserved table 26-4. enable master/slave block operation enable master enable slave block operation no no disabled: the block is disconnected from the gpio pins, p1_5 and p1_7 (the pins may be used as general purpose io). when either the master or slave is enabled, the gpio pins are under control of the i2c hardware and are unavailable. all internal registers (except i2c_cfg) are held in reset. no ye s slave only mode: any external start condition will cause the block to start receiving an address byte. regardless of the current state, any start resets the interface and ini- tiates a receive operation. any stop will cause the block to revert to an idle state the i2c_mscr register is held in reset. yes no master only mode: in this mode, external start conditions are ignored. no byte complete interrupts on external traffic are generated, but the bus busy status bit continues to capture start and stop status and thus, may be polled by the master to determine if the bus is avail- able. full multi-master capab ility is enabled, including clock synchronization and arbitration. the block will generate a clock based on the setting in the clock rate register yes ye s master/slave mode: in this mode, both master and slave may be opera- tional. the block may be addressed as a slave, but firmware may also initiate master mode transfers. in this configuration, when a master loses arbitration during an address byte, the hardware will revert to slave mode and the received byte will generate a slave address interrupt.
december 22, 2003 document no. 38-12009 rev. *d 267 cy8c22xxx preliminary data sheet 26. i2c 26.3.2 i2c_scr register this register is the i2c status and control register and is used to control both master and slave data transfer. it con- tains status bits for determining the state of the current i2c transfer, and control bits, which determine the actions for the next byte transfer. at the end of each byte transfer, the i2c hardware will interrupt the host processor and stall the bus on the subsequent low of the clock until the host intervenes with the next command. this register may be read as many times as necessary, but on a subsequent write, the bus stall will be released and the current transfer will continue. there are six status bits: byte complete, lrb, address, stop status, lost arb, and bus error. these bits have read/ clear (r/c) access, which means that they are set by hard- ware but may be cleared by a write of ?0? to the bit position. under certain conditions, status is cleared automatically by the hardware. these cases are noted in tab l e 2 6- 5 . there are two control bits: transmit and ack. these bits have r/w access. these bits may also be cleared by hard- ware, as noted. bit 7: bus error. the bus error status detects misplaced start or stop conditions on the bus. these may be due to noise, rogue devices, or other devices that are not yet syn- chronized with the i2c bus traffic. according to the i2c specification mentioned previously, all compatible devices must reset their interface on a received start or stop. this is a natural thing to do in slave mode, because a start will ini- tiate an address reception and a stop will idle the slave. in the case of a master, this event will force the master to release the bus and idle. however, since a master does not respond to external start or stop conditions, an immediate interrupt on this event allows the master to continue to keep track of the bus state. a bus error is defined as follows. a start is only valid if the block is idle (master or slave) or a slave receiver is ready to receive the first bit of a new byte after an ack. any other timing for a start condition causes the bus error bit to be set. a stop is only valid if the block is idle or a slave receiver is ready to receive the first bit of a new byte after an ack. any other timing for a stop condition causes the bus error bit to be set. bit 6: lost arb. this bit is set when i2c bus contention is detected, during a master mode transfer. contention will occur when a master is writing a ?1? to the sda output line and reading back a ?0? on the sda input line at given sam- pling point. when this occurs, the block immediately releases the sda, but continues clocking to the end of the current byte. on the resulting byte interrupt, firmware can determine that arbitration was lost to another master. table 26-5. i2c_scr status and control register bit access description mode 0 r/c byte complete transmit mode: 1 = 8 bits of data have been transmitted and an ack or nack has been received. receive mode: 1 = 8 bits of data have been received. any start detect will automatically clear this bit. master/ slave 1 r/c lrb last received bit. the value of the 9 th bit in a transmit sequence, which is acknowl- edge bit from the receiver. 0 = last transmitted byte was acked by the receiver. 1 = last transmitted byte was nacked by the receiver. any start detect will automatically clear this bit. master/ slave 2 r/w transmit 0 = receive mode. 1 = transmit mode. this bit is set by firmware to define the direction of the byte transfer. any start detect will automatically clear this bit. master/ slave 3 r/c address 1 = the transmitted or received byte is an address. this status bit must be cleared by firmware with write of ?0? to the bit position. master/ slave 4 r/w ack acknowledge out 0 = nack the last received byte. 1 = ack the last received byte. this bit is automatically cleared by hard- ware on the following byte complete event. master/ slave 5 r/c stop status 1 = a stop condition was detected. this status bit must be cleared by firmware with write of ?0? to the bit position. it is never cleared by the hardware. master/ slave 6 r/c lost arb 1 = lost arbitration. this bit is set immediately on lost arbitra- tion; however, it does not cause an inter- rupt. this status may be checked after the following byte complete interrupt. any start detect will automatically clear this bit. master only 7 r/c bus error 1 = a misplaced start or stop condition was detected. this status bit must be cleared by firmware with write of ?0? to the bit position. it is never cleared by the hardware. master only table 26-5. i2c_scr status and control register (continued) bit access description mode
26. i2c cy8c22xxx preliminary data sheet 268 document no. 38-12009 rev. *d december 22, 2003 the sequence occurs differently between master transmitter and master receiver. as a transmitter, the contention will occur on a data bit. on the subsequent byte complete inter- rupt, the lost arbitration status will be set. in receiver mode, the contention will occur on the ack bit. the master that nacked the last reception will lose the arbitration. however, the hardware will shift in the next byte in response to the winning master?s ack, so that a subsequent byte complete interrupt occurs. at this point, the losing master can read the lost arbitration status. contention is checked only at the eight data bit sampling points and one ack bit sampling point. bit 5: stop status. stop status is set on detection of an i2c stop condition. this bit is sticky, which means that it will remain set until a ?0? is written back to it by the firmware. this bit may only be cleared if byte complete status is set. if the stop interrupt enable bit is set, an interrupt will also be generated on stop detection. it is never automatically cleared. using this bit, a slave can distinguish between a previous stop or restart on a given address byte interrupt. in master mode, this bit may be used in conjunction with the stop ie bit, to generate an interrupt when the bus is free. however, in this case, the bit must have previously been cleared prior to the reception of the stop, in order to cause an interrupt. bit 4: ack. this control bit defines the acknowledge data bit that will be transmitted out in response to a received byte. when receiving, a byte complete interrupt is gener- ated after the eighth data bit is received. on the subsequent write to this register to continue (or terminate) the transfer, the state of this bit will determine the next bit of data that will be transmitted. it is active high. a ?1? will send an ack and a ?0? will send a nack. a master receiver normally terminates a transfer, by writing a ?0? (nack) to this bit. this releases the bus and automati- cally generates a stop condition. a slave receiver may also send a nack, to inform the master that it cannot receive any more bytes. bit 3: address. this bit is set when an address has been received. this consists of a start or restart, and an address byte. this bit applies to both master and slave. in slave mode, when this status is set, firmware will read the received address from the data register and compare it with its own address. if the address does not match, the firmware will write a nack indication to this register. no further inter- rupts will occur, until the next address is received. if the address does match, firmware must ack the received byte, then byte complete interrupts will be generated on subse- quent bytes of the transfer. this bit will also be set when address transmission is com- plete in master mode. if a lost arbitration occurs during the transmission of a master address, indicated by the lost arb bit, the block will revert to slave mode if enabled. this bit then signifies that the block is being addressed as a slave. if slave mode is not enabled, the byte complete interrupt will still occur to inform the master of lost arbitration. bit 2: transmit. this bit sets the direction of the shifter for a subsequent byte transfer. the shifter is always shifting in data from the i2c bus, but a write of ?1? enables the output of the shifter to drive the sda output line. since a write to this register initiates the next transfer, data must be written to the data register prior to writing this bit. in receive mode, the previously received data must have been read from the data register before this write. in slave mode, firmware derives this direction from the r/w bit in the received slave address. in master mode, the firmware decides on the direction and sets it accordingly. this direction control is only valid for data transfers. the direction of address bytes is determined by the hardware, depending on the master or slave mode. the master transmitter terminates a transfer by writing a zero to the transmit bit. this releases the bus and automati- cally sends a stop condition, or a stop/start or restart, depending on the i2c_mscr control bits. bit 1: lrb (last received bit). this is the last received bit in response to a previously transmitted byte. in transmit mode, the hardware will send a byte from the data register and clock in an acknowledge bit from the receiver. on the subsequent byte complete interrupt, firmware will check the value of this bit. a ?0? is the ack value and a ?1? is a nack value. the meaning of the lrb depends on the current operating mode. master transmitter: ?0?: ack, the slave has accepted the previous byte. the master may send another byte by first writing the byte to the i2c_dr register and then setting the transmit bit in the i2c_scr register. optionally, the master may clear the transmit bit in the i2c_scr register. this will automatically send a stop. if the start or restart bits are set in the i2c_mscr register, the stop may be followed by a start or restart. ?1?: nack, the slave cannot accept any more bytes. a stop is automatically generated by the hardware on the subse- quent write to the i2c_scr register (regardless of the value written). however, a stop/start or restart condition may also be generated, depending on whether firmware has set the start or restart bits in the i2c_mscr register. slave transmitter: ?0?: ack, the master wants to read another byte. the slave should load the next byte into the i2c_dr register and set the transmit bit in the i2c_scr register, to continue the transfer. ?1?: nack, the master is done reading bytes. the slave will revert to idle state on the subsequent i2c_scr write (regardless of the value written).
december 22, 2003 document no. 38-12009 rev. *d 269 cy8c22xxx preliminary data sheet 26. i2c bit 0: byte complete. the i2c hardware operates on a byte basis. in transmit mode, this bit is set and an interrupt is generated at the end of nine bits (the transmitted byte + the received ack). in receive mode, the bit is set after the eight bits of data have been received. when this bit is set, an interrupt is generated at these data sampling points, which are associated with the scl input clock rising (see details in the timing section). if the host responds with a write back to this register before the subsequent falling edge of scl (which is approximately one-half bit time), the trans- fer will continue without interruption. however, if the host is unable to respond within that time, the hardware will hold the scl line low, stalling the i2c bus. in both master and slave mode, a subsequent write to the i2c_scr register will release the stall. for additional information, reference the i2c_scr register on page 126 . 26.3.3 i2c_dr register this register is the i2c data register and provides read/write access to the shift register. it is not buffered and therefore, writes and valid data reads may only occur at specific points in the transfer. these cases are outlined as follows. master or slave receiver data in the i2c_dr register is only valid for reading, when the byte complete status bit is set. data bytes must be read from the register before writing to the i2c_scr register, which continues the transfer. master start or restart address bytes must be written in i2c_dr before the start or restart bit is set in the i2c_mscr register, which causes the start or restart to be generated and the address shifted out. master or slave transmitter data bytes must be writ- ten to the i2c_dr register before the transmit bit is set in the i2c_scr register, which causes the transfer to con- tinue. for additional information, reference the i2c_dr register on page 127 . 26.3.4 i2c_mscr register this register is the i2c master status and control register. bits 7 to 4: reserved. bit 3: bus busy. this read only bit is set to ?1? by any start condition and reset to ?0? by a stop condition. it may be polled by firmware to determine when a bus transfer may be initiated. bit 2: master mode. this bit indicates that the device is operating as a master. it is set in the detection of this block?s start condition and reset in the detection of the subsequent stop condition. bit 1: restart gen. this bit is only used at the end of a master transfer (as noted in other cases 1 and 2 above of the start gen bit). if an address is loaded into the data regis- ter and this bit is set prior to nacking (master receiver) or resetting the transmit bit (master transmitter), or after a mas- ter transmitter is nacked by the slave, a restart condition will be generated, followed by the transmission of the address byte. bit 0: start gen. before setting this bit, firmware must write the address byte to send into the i2c_dr register. when this bit is set, the start condition is generated, followed immediately by the transmission of the address byte. (no control in the i2c_scr register is needed for the master to initiate a transmission; the direction is inherently ?transmit?.) the bit is automatically reset to ?0? after the start has been generated. there are three possible outcomes as a result of setting the start gen bit: 1. the bus is free and the start condition is generated suc- cessfully. a byte complete interrupt will be generated after the start and the address byte has been transmit- ted. if the address was acked by the receiver, the firm- ware may then proceed to send data bytes. 2. the start command is too late. another master in a multi-master environment has generated a valid start and the bus is busy. the resulting behavior depends upon whether slave mode is enabled. slave mode is enabled: a start and address byte inter- rupt will be generated. when reading the i2c_mscr, the master will see the start gen bit still set and the i2c_scr will have the address bit set, indicating that the block has been addressed as a slave. table 26-6. i2c_mscr master status and control register bit access description mode 0 r/w start gen 1 = generate a start condition and send a byte (address) to the i2c bus. this bit is cleared by hardware when the start generation is complete. master only 1 r/w restart gen 1 = generate a restart condition. this bit is cleared by hardware when the start generation is complete. master only 2 ro master mode this bit is set to ?1? when a start condition, generated by this block, is detected and reset to ?0? when a stop condition is detected. master only 3 ro bus busy this bit is set to ?1? when any start condition is detected, and reset to ?0? when a stop condition is detected. master only table 26-6. i2c_mscr master status and control register (continued) bit access description mode
26. i2c cy8c22xxx preliminary data sheet 270 document no. 38-12009 rev. *d december 22, 2003 slave mode is not enabled: the start gen bit will remain set and the start will be queued, until the bus becomes free and the start condition will be subsequently gener- ated. an interrupt will be generated at a later time, when the start and address byte has been transmitted. 3. the start is generated, but the master loses arbitration to another master in a multi-master environment. the resulting behavior depends upon whether slave mode is enabled. slave mode is enabled: a start and address byte inter- rupt will be generated. when reading the i2c_mscr, the master will see the start gen bit cleared, indicating that the start was generated. however, the lost arb bit will be set in the i2c_scr register. the address status will also be set, indicating that the block has been addressed as a slave. the firmware may then ack or nack the address to continue the transfer. slave mode is not enabled: a start and address byte interrupt will be generated. the start gen bit will be cleared and the lost arb bit will be set. the hardware will wait for command input, stalling the bus if necessary. in this case, the master will clear the i2c_scr register, to release the bus and allow the transfer to continue, and the block will idle. other cases where the start bit may be used to generate a start condition are as follows: 1. when a master is finished with a transfer, a nack will be written to the i2c_scr register, in the case of the mas- ter receiver, or the transmit bit will be cleared, in case of a master transmitter. normally, the action will free the stall and generate a stop condition. however, if the start bit is set and an address is written into the data register prior to the i2c_scr write, a stop, followed immediately by a start (minimum bus free time), will be generated. in this way, messages may be chained. 2. when a master transmitter is nacked, an automatic stop condition is generated on the subsequent i2c_scr write. however, if the start gen bit has previously been set, the stop will be immediately followed by a start con- diton. for additional information, reference the i2c_mscr register on page 128 . 26.4 timing diagrams 26.4.1 clock generation figure 26-4 illustrates the i2c input clocking scheme. the sysclk pin is an input into a four-stage ripple divider that provides the baud rate selections. when the block is dis- abled, all internal state is held in a reset state. when either the master or slave enable bits in the i2c_cfg register are set, the reset is synchronously released and the clock gen- eration is enabled. two taps from the ripple divider are selectable (/4, /16) from the clock rate bits in the i2c_cfg register. as an additional option, the block may be clocked directly from sysclk, to achieve the highest baud rate. if any of the two divider taps is selected, that clock is resyn- chronized to sysclk. the resulting clock is routed to all of the synchronous elements in the design. figure 26-4. i2c input clocking i/o write sysclk 4 2 8 16 two sysclks to first block clock. enable block reset resync clock default 16
december 22, 2003 document no. 38-12009 rev. *d 271 cy8c22xxx preliminary data sheet 26. i2c 26.4.2 enable and command synchronization figure 26-5 illustrates an all block reset (except for the i2c_cfg register) is asserted when the block is disabled. when either the enable master or enable slave bit is set, the block reset is negated on the next positive edge of sysclk, which ensures a full sysclk cycle of setup time on the next clock edge. figure 26-5. i2c enable figure 26-6 illustrates a start gen command or i2c_scr write after byte complete is resynchronized to the following block clock edge. i2c processing continues on the selected block clock following this resync clock edge. figure 26-6. i2c command 26.4.3 basic input/output timing figure 26-7 illustrates basic input output timing that is valid for both 16x sampling and 32x sampling. for 16x sampling, n=4 and for 32x sampling n=12. n is derived from the half bit rate sampling of eight and 16 clocks, respectively, minus the input latency of three (count of 4 and 12 correspond to 5 and 13 clocks). figure 26-7. basic input/output timing i2c_reset prescaler sysclk clock iow cmd_go block clock state iow idle or wait next state scl scl_in clock sda_out clk ctr n 1 2 n 0 1 2 n 0 0 shift sda_in lost arb status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26. i2c cy8c22xxx preliminary data sheet 272 document no. 38-12009 rev. *d december 22, 2003 26.4.4 status timing figure 26-8 illustrates the interrupt timing for byte com- plete, which occurs on the positive edge of the ninth clock (byte + ack/nack) in transmit mode and on the positive edge of the eighth clock in receive mode. there is a maxi- mum of three cycles of latency due to the input synchro- nizer/filter circuit. as shown, the interrupt occurs on the clock following a valid scl positive edge input transition (after the synchronizers). the address bit is set with the same timing, but only after a slave address has been received. the lrb (last received bit) status is also set with the same timing, but only on the ninth bit after a transmitted byte. figure 26-8. byte complete, address, lrb timing figure 26-9 shows the timing for stop status. this bit is set (and the interrupt occurs) two clocks after the synchronized and filtered sda line transitions to a ?1?, when the scl line is high. figure 26-9. stop status and interrupt timing figure 26-10 illustrates the timing for bus error interrupts. bus error status (and interrupt) occurs one cycle after the internal start or stop detect (two cycles after the filtered and synced sda input transition). figure 26-10. bus error interrupt timing 3 cycles latency clock transmit: 9 th positive edge scl receive: 8 th positive edge scl scl scl_in (synched) irq max clock scl sda_in (synced) stop irq and status sda stop detect clock scl sda_in (synced) bus error and interrupt sda start detect misplaced start misplaced stop clock scl sda_in (synced) bus error and interrupt sda stop detect
december 22, 2003 document no. 38-12009 rev. *d 273 cy8c22xxx preliminary data sheet 26. i2c 26.4.5 master start timing when firmware writes the start gen command, hardware resynchronizes this bit to sysclk, to ensure a minimum of a full sysclk of setup time to the next clock edge. when the start is initiated, the scl line is left high for 6/14 clocks (corresponding to 16/32x sampling rates). during this initial scl high period, if an external start is detected, the start sequence is aborted and the block returns to an idle state. however, on the next stop detection, the block will automat- ically initiate a new start sequence. figure 26-11. basic master start timing figure 26-12. start timing with a pending start cmd start sda clock scl start detect i/o write 6/14 clocks 8/16 clocks 5 clocks 8/16 clocks to next scl high scl sda clock bus busy sda_in (synced) stop/start detect scl_out sda_out other master sda other master scl start stop 8 clocks 8 clocks 7 clocks / 4.7 s 6 clocks / 4.0 s minimum bus free minimum start hold
26. i2c cy8c22xxx preliminary data sheet 274 document no. 38-12009 rev. *d december 22, 2003 figure 26-13. master stop/start chaining 26.4.6 master restart timing figure 26-14. master restart timing 26.4.7 master stop timing figure 26-15 shows basic master stop timing. in order to generate a stop, the sda line is first pulled low, in accor- dance with the basic sda output timing. then, after the full low of scl is completed and the scl line is pulled high, the sda line remains low for a full one-half bit time before it is pulled high to signal the stop. figure 26-15. master stop timing scl sda clock sda_in (synced) stop/start detect scl_out sda_out start stop 5/13 clocks 8/16 clocks 2 clocks scl sda master tx: rx ack/nack master rx: tx nack 8/16 8/16 8/16 8/16 scl sda clock 2 clocks 8/16 clocks 8/16 clocks scl_in
december 22, 2003 document no. 38-12009 rev. *d 275 cy8c22xxx preliminary data sheet 26. i2c 26.4.8 master/slave stall timing when a byte complete interrupt occurs, the host firmware must respond with a write to the i2c_scr register to con- tinue the transfer (or terminate the transfer). the interrupt occurs two clocks after the rising edge of scl_in (see sta- tus timing). as illustrated in figure 26-16 , firmware has until one clock after the falling edge of scl_in to write to the i2c_scr register; otherwise, a stall will occur. once stalled, the io write will release the stall. the setup time between data output and the next rising edge of scl will always be n-1 clocks. figure 26-16. master/slave stall timing 26.4.9 master lost arbitration timing figure 26-17 shows a lost arbitration sequence. when con- tention is detected at the input (sda_in) sampling point, the sda output is immediately released to an idle1 state. how- ever, the master will continue clocking until the byte com- plete interrupt, which is processed in the usual way. any write to the i2c_scr register will result in the master revert- ing to an idle state, one clock after the next positive edge of the scl_in clock. figure 26-17. lost arbitration timing (transmitting address or data) scl clock scl_in (synced) sda_out i/o write 1 clocks n-1 clocks stall no stall scl_out sda sda_out scl scl_out irq iow to scr on input detection (scl_in) of this positive edge, the device reverts to an idle state on the following block clock. contention detected at data sampling point. next byte or stop ack b7 b6 b5 b4 regardless of low timing (whether you stall or not), the device counts out the following iow of the clock.
26. i2c cy8c22xxx preliminary data sheet 276 document no. 38-12009 rev. *d december 22, 2003 26.4.10 master clock synchronization figure 26-18 shows the timing associated with master clock synchronization. clock synchronization is always opera- tional, even if it is the only master on the bus. in which case, it is synchronizing to its own clock. in the wired and bus, an scl output of ?0? will be seen by all masters. when the hard- ware asserts a ?0? to the output, it is immediately fed back from the chip pin to the input synchronizer for the scl input. the counter value (depending on the sampling rate) takes into account the worst case latency for input synchronization of three clocks, giving a net period of 8/16 clocks for both high and low time. this results in an overall clocking rate of 16/32 clocks per bit. in multi-master environments, when the hardware outputs a ?1? on the scl output, if any other master is still asserting a ?0?, the clock counter will hold until the scl input line matches the ?1? on the scl output line. when matched, the remainder of the high time is counted down. in this way, the master with the fastest frequency determines the high time of the clock and the master with the lowest frequency deter- mines the low time of the clock. figure 26-18. master clock synchronization scl scl_in clock scl_out sync and filter 0 n 3 2 1 n hold off counting until the input clock is equal to the output clock ... 0 3 2 1
december 22, 2003 document no. 38-12009 rev. *d 277 27. por and lvd this chapter briefly discusses the por and lvd circuits and their associated registers. 27.1 architectural description power-on-reset (por) and low voltage detect (lvd) cir- cuits provide protection against low voltage conditions. the por function senses vdd and holds the system in reset, until the magnitude of vdd will support operation to spec. the lvd function senses vdd and provides an interrupt to the system when vdd falls below a selected threshold. other outputs and status bits are provided to indicate impor- tant voltage trip levels. 27.2 register definitions this block contains two registers: vlt_cr and vlt_cmp (read only status bits). 27.2.1 vlt_cr register the vlt_cr register is cleared by all resets, which can cause reset-cycling during very slow supply ramps to 5v, when the por range is set for the 5v range. this is because the reset will clear the por range setting back to 3v and a new boot/start-up occurs (possibly many times). the user can manage this with sleep mode and/or reading voltage status bits, if such cycling is an issue. bits 7 and 6: reserved. bits 5 and 4: porlev[1:0]. porlev[1:0] sets the vdd level at which ppor switches. bit 3: lvdtben. lvdtben is and?ed with lvd to pro- duce a throttle-back signal that reduces cpu clock speed when low voltage conditions are detected. bits 2, 1, and 0: vm[2:0]. vm[2:0] sets the vdd level of the lvd comparator switch. for additional information, reference the vlt_cr register on page 168 . 27.2.2 vlt_cmp register bits 7 and 2: reserved. bit 1: lvd. lvd reads the state of the low voltage detect comparator. the trip point for lvd is set by vm[2:0] in the vlt_cr register. bit 0: ppor. the ppor bit reads back the state of the ppor output. this can only be meaningfully read with por- lev[1:0] set to disable ppor. in that case, the ppor sta- tus bit shows the comparator state directly. for additional information, reference the vlt_cmp register on page 169 . table 27-1. por and lvd registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access 1,e3h vlt_cr porlev[1:0] lvdtben vm[2:0] rw : 00 1,e4h vlt_cmp lvd ppor r : 00
27. por and lvd cy8c22xxx preliminary data sheet 278 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 279 28. internal voltage reference this chapter briefly discusses the internal voltage reference and its associated register. the internal voltage reference pro- vides an absolute value of 1.3v to a variety of subsystems in the psoc device. 28.1 architectural description the internal voltage reference is made up of two blocks: a bandgap voltage generator and a buffer with sample and hold. the bandgap voltage generator is a typical (v be + k v t ) design. the buffer circuit provides gain to the bandgap voltage, to produce a 1.30v reference. a simplified schematic is illus- trated in figure 28-1 . the connection between amplifier and capacitor is made through a cmos switch, allowing the ref- erence voltage to be used by the system while the reference circuit is powered down. the voltage reference is trimmed to 1.30v at room temperature. figure 28-1. voltage reference schematic a temperature proportional voltage is also produced in this block for use in temperature sensing. 28.2 register definitions the internal voltage reference is trimmed for gain and tem- perature coefficient with a single write-only register, bdg_tr. 28.2.1 bdg_tr register bits 7 and 6: reserved. bits 5 and 4: tc[1:0]. these bits are for setting the tem- perature coefficient inside the bandgap voltage generator. 10b is the design center for 0 tc. bits 3 to 0: v[3:0]. these bits are for setting the gain in the reference buffer. sixteen steps of 4 mv are available. 1000b is the design center for 1.30v. for additional information, reference the bdg_tr register on page 172 . table 28-1. internal voltage reference register address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access 1,eah bdg_tr tc[1:0] v[3:0] rw:00 v bg + - s + h v ref
28. internal voltage reference cy8c22xxx preliminary data sheet 280 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 281 29. system resets this chapter discusses the system resets and its associated registers. the m8c supports several types of resets. the vari- ous resets are designed to provide error-free operation during power up for any voltage ramping profile, to allow for user-sup- plied external reset and to provide recovery from errant code operation. when reset is initiated, all registers are restored to their default states. minor exceptions are explained below. the following types of resets can occur: power-on reset (por). this occurs at low supply volt- age and is comprised of multiple sources. external reset (xres). this active high reset is driven into the chip, on parts that contain an xres pin. watchdog reset (wdr). this optional reset occurs when a timer expires, before being cleared by user firm- ware. internal reset (ires). this occurs during the boot sequence, if the srom code determines that flash reads are not valid. the occurrence of a reset is recorded in the status and con- trol register (cpu_scr, for por/xres/wdr), or in the system status and control register 1 (cpu_scr1, for iress). firmware can interrogate these registers to deter- mine the cause of a reset. 29.1 register definitions 29.1.1 cpu_scr0 register the bits of the cpu_scr0 register are used to convey sta- tus and control of events for various functions of a psoc device. bit 7: gies. the global interrupt enable status bit is a read only status bit and its use is discouraged. the gies bit is a legacy bit which was used to provide the ability to read the gie bit of the cpu_f register. however, the cpu_f reg- ister is now readable. when this bit is set, it indicates that the gie bit in the cpu_f register is also set which, in turn, indicates that the microprocessor will service interrupts. bit 6: reserved. bit 5: wdrs. the watchdog reset status bit is normally zero, but set whenever a watchdog reset occurs. the bit is readable and clearable by writing a zero to its bit position in the cpu_scr0 register. this bit may not be set. bit 4: pors. the power-on reset status (pors) bit and watchdog enable bit will be set automatically by a por or external reset. if the bit is cleared by user code, the watch- dog timer will be enabled. once cleared, the only way to reset the pors bit is to go through a por or external reset. thus, there is no way to disable the watchdog timer, other than to go through a por or external reset. bit 3: sleep. the sleep bit is used to enter low power sleep mode when set, as described in this chapter. bits 2 and 1: reserved. bit 0: stop. the stop bit is readable and writeable. when set, the psoc m8c will stop executing code until a reset event occurs. this can be either a por, watchdog reset, or external reset. if an application wants to stop code execution until a reset, the preferred method would be to use the halt instruction rather than a register write to this bit. for additional information, reference the cpu_scr0 regis- ter on page 144 . table 29-1. system reset registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 access 0,feh cpu_scr1 iramdis rw : 00 0,ffh cpu_scr0 gies wdrs pors sleep stop rw : xx legend xx: the reset value is 10h after por/xres and 20h after a watchdog reset.
29. system resets cy8c22xxx preliminary data sheet 282 document no. 38-12009 rev. *d december 22, 2003 29.1.2 cpu_scr1 register the cpu_scr1 register is used to convey status and con- trol of events related to internal resets and watchdog reset. bits 7 to 1: reserved. bit 0: iramdis. the initialize ram disable bit is a control bit that is readable and writeable. the default value for this bit is 0, which indicates that the maximum amount of sram should be initialized on watchdog reset to a value of 00h. when the bit is set, the minimum amount of sram is initial- ized after a watchdog reset. for more information on this bit, see the ?srom function descriptions? on page 46 in the srom chapter. for additional information, reference the cpu_scr1 regis- ter on page 143 . 29.2 timing diagrams 29.2.1 power on reset (por) a power-on reset (por) is triggered whenever the supply voltage is below the por trip point. por ends once the sup- ply voltage rises above this voltage. refer to the por and lvd chapter for more information on the operation of the por block. por consists of two pieces: an imprecise por (ipor) and a precision por (ppor). ?por? refers to the or of these two functions. ipor has coarser accuracy and its trip point is typically lower than ppor?s trip point. ppor is derived from a circuit that is calibrated (during boot), for very accu- rate location of the por trip point. during por (por=1), the imo is powered off for low power during start-up. once por de-asserts, the imo is started (see figure 29-1 ). por configures register reset status bits as shown in table 29-2 . ppor does not affect the bandgap trim regis- ter (bdg_tr), but ipor does reset this register. 29.2.2 external reset (xres) a xres reset is caused by pulling the xres pin high. the xres pin has an always-on pull down resistor, so it does not require an external pull down for operation and can be tied directly to ground or left open. behavior after xres is simi- lar to por. during xres (xres=1), the imo is powered off for low power during start-up. once xres de-asserts, the imo is started (see figure 29-1 ). xres configures register reset status bits as shown in table 29-2 . 29.2.3 watchdog timer reset (wdr) the user has the option to enable the wdr, by clearing the pors bit in the cpu_scr0 register. once the pors bit is cleared, the watchdog timer cannot be disabled. the only exception to this is if a por/xres event takes place, which will disable the wdr. see ?watchdog timer (wdt)? on page 79 for details of the watchdog operation. when the watchdog timer expires, a watchdog event occurs resulting in the reset sequence. some wdr unique items are as follows. chip reset asserts for one cycle of the clk32k clock (at its reset state). the imo is not halted during or after wdr, i.e., the part does not go through a low power phase. cpu operation re-starts one clk32k cycle after the internal reset de-asserts (see figure 29-2 ). wdr configures register reset status bits as shown in tab l e 2 9- 2 .
december 22, 2003 document no. 38-12009 rev. *d 283 cy8c22xxx preliminary data sheet 29. system resets figure 29-1. key signals during por and xres imo pd imo (not to scale) cpu reset por (ipor followed by ppor): reset while por high (imo off), then 511(+) cycles (imo on), and then cpu reset released. xres is the same, with n=8. clk32 reset sleep timer 0 01511 n=512 (follows por / xres) imo pd imo (not to scale) cpu reset ppor (with no ipor): reset while ppor high and to the end of the next 32k cycle (imo off); 1 cycle imo on before cpu reset released. note that at the 5v level, ppor will tend to be brief, because the reset clears the por range register (vlt_cr) back to the default 3v setting. clk32 ppor sleep timer 0 12 reset ipor ppor imo pd imo (not to scale) cpu reset xres : reset while xres high (imo off), then 7(+) cycles (imo on), and then cpu reset released. clk32 reset sleep timer 127 8 xres 0
29. system resets cy8c22xxx preliminary data sheet 284 document no. 38-12009 rev. *d december 22, 2003 figure 29-2. key signals during wdr and ires 29.2.4 reset details timing and functionality details are summarized in tab l e 2 9- 2 . figure 29-1 shows some of the relevant signals for ipor, ppor, and xres. clk32 reset sleep timer imo pd imo (not to scale) cpu reset 0 1 2 n=2048 ires : reset 1 cycle; then 2048 additional cycles low power hold-off, then 1 cycle with imo on before cpu reset released. wdr : reset 1 cycle; then one additional cycle before cpu reset released. imo pd imo (not to scale) cpu reset (stays low) reset sleep timer 0 12 clk32 table 29-2. details of functionality for various resets item ipor (part of por) ppor (part of por) xres wdr reset length while por=1 while ppor=1, plus 30-60 us (1-2 clocks) while xres=1 30 us (1 clock) low power (imo off) during reset? ye s ye s ye s no low power wait following reset no no no no clk32k cycles from end of reset to cpu reset de- asserts** 512* 1 8* 1 register reset (see next line for cpu_scr, cpu_scr1) all all, except ppor does not reset bandgap trim register all all reset status bits in cpu_scr, cpu_scr1 set pors clear wdrs clear iramdis set pors set pors clear wdrs clear iramdis set wdrs bandgap power on on on on * this count can be up to one clk32k cycle less, depending on relative timing between the reset and the clk32k clock. ** cpu reset is released after synchronization with cpu clock. *** note if ipor and ppor occur together on a power up, key acquire will occur due to the ipor.
december 22, 2003 document no. 38-12009 rev. *d 285 cy8c22xxx preliminary data sheet 29. system resets 29.3 power consumption the ilo block drives the clk32k clock used to time most events during the reset sequence. this clock is powered down by ipor, but not by any other reset. the sleep timer provides interval timing. while por or xres assert, the imo is powered off to reduce start-up power consumption. during and following ires (for 64 ms nominally), the imo is powered off for low average power, during slow supply ramps. during and after por or xres, the bandgap circuit is pow- ered up. following ires, the bandgap circuit is only powered up occasionally, to refresh the sampled bandgap voltage value. this sampling follows the same process used during sleep mode. the imo is always on for at least one clk32k cycle, before cpu reset is de-asserted.
29. system resets cy8c22xxx preliminary data sheet 286 document no. 38-12009 rev. *d december 22, 2003
december 22, 2003 document no. 38-12009 rev. *d 287 section g electrical specifications the electrical specifications section presents the dc and ac electrical specifications of the psoc device. specifications are valid for -40 o c t a 85 o c and t j 100 o c as specified, except where noted. specifications for devices running at 24 mhz are valid at -40 o c t a 70 o c and t j 82 o c. voltage frequency graph 5.25 4.75 3.00 93 khz 12 mhz 24 mhz frequency voltage
section g electrical specifications cy8c22xxx preliminary data sheet 288 document no. 38-12009 rev. *d december 22, 2003 the following table lists the units of measure used in this section. absolute maximum ratings operating temperature symbol units of measure symbol units of measure o c degree celsius s microsecond ac alternating current v microvolts db decibels vrms microvolts root-mean-square dc direct current ma milliampere ff femto farad ms millisecond hz hertz mv millivolts k kilo, 1000 ns nanosecond k 2 10 , 1024 nv nanovolts kb 1024 bytes ? ohm kbit 1024 bits pf pico farad khz kilohertz pp peak-to-peak k ? kilohm ppm parts per million mhz megahertz sps samples per second m ? megaohm sigma: one standard deviation a microampere v volts absolute maximum ratings symbol description min typ max units notes t stg storage temperature -65 ? +100 o c higher storage temperatures will reduce data retention time. t a ambient temperature with power applied -40 ? +85 o c vdd supply voltage on vdd relative to vss -0.5 ? +6.0 v v io dc input voltage vss-0.5 ? vdd+0.5 v ? dc voltage applied to tri-state vss-0.5 ? vdd+0.5 v i mio maximum current into any port pin -25 ? +50 ma i maio maximum current into any port pin configured as analog driver -50 ? +50 ma ? static discharge voltage 2000 ? ? v ? latch-up current ? ? 200 ma operating temperature symbol description min typ max units notes t a ambient temperature -40 ? +85 o c t j junction temperature -40 ? +100 o c the temperature rise from ambient to junc- tion is package specific. see ?thermal impedances? on page 30 . the user must limit the power consumption to comply with this requirement.
december 22, 2003 document no. 38-12009 rev. *d 289 cy8c22xxx preliminary data sheet section g electrical specifications dc electrical characteristics dc chip-level specifications the following table lists guaranteed maximum and minimum specifications for the voltage and temperature ranges: 4.75v to 5.25v and -40 c t a 85 c, or 3.0v to 3.6v and -40 c t a 85 c, respectively. typical parameters apply to 5v and 3.3v at 25 c and are for design guidance only or unless otherwise specified. dc general purpose io (gpio) specifications the following table lists guaranteed maximum and minimum specifications for the voltage and temperature ranges: 4.75v to 5.25v and -40 c t a 85 c, or 3.0v to 3.6v and -40 c t a 85 c, respectively. typical parameters apply to 5v and 3.3v at 25 c and are for design guidance only or unless otherwise specified. dc chip-level specifications symbol description min typ max units notes vdd supply voltage 3.00 ? 5.25 v i dd supply current ? 5 8 ma conditions are 5.0v, 25 o c, 3 mhz, 48 mhz disabled. vc1=1.5 mhz, vc2=93.75 khz, vc3=93.75 khz. i sb sleep (mode) current with por, lvd, sleep timer, and wdt. a a. standby current includes all functions (por, lvd, wdt, sleep time) needed for reliable system operation. this should be compa red with devices that have similar functions enabled. ? 3 6.5 a conditions are with internal slow speed oscil- lator, vdd = 3.3 v, -40 o c <=t a <= 55 o c. i sbh sleep (mode) current with por, lvd, sleep timer, and wdt. a ? 4 25 a conditions are with internal slow speed oscil- lator, vdd = 3.3 v, 55 o c < t a <= 85 o c. i sbxtl sleep (mode) current with por, lvd, sleep timer, and wdt. a ? 4 7.5 a conditions are with properly loaded, 1 uw max, 32.768 khz crystal. vdd = 3.3 v, -40 o c <= t a <= 55 o c. i sbxtlh sleep (mode) current with por, lvd, sleep timer, and wdt. a ? 5 26 a conditions are with properly loaded, 1 uw max, 32.768 khz crystal. vdd = 3.3 v, 55 o c < t a <= 85 o c. v ref reference voltage (bandgap) 1.275 1.3 1.325 v trimmed for appropriate vdd. dc gpio specifications symbol description min typ max units notes r pu pull up resistor 4 5.6 8 k ? r pd pull down resistor 4 5.6 8 k ? v oh high output level vdd - 1.0 ? ? v ioh = 10 ma, vdd = 4.75 to 5.25v (80 ma maximum combined ioh budget) v ol low output level ? ? 0.75 v iol = 25 ma, vdd = 4.75 to 5.25v (150 ma maximum combined iol budget) v il input low level ? ? 0.8 v vdd = 3.0 to 5.5 v ih input high level 2.2 ? v vdd = 3.0 to 5.5 v h input hysterisis ? 60 ? mv i il input leakage (absolute value) ? 1 ? na gross tested to 1 a. c in capacitive load on pins as input ? 3.5 10 pf package and pin dependent. temp = 25 o c. c out capacitive load on pins as output ? 3.5 10 pf package and pin dependent. temp = 25 o c.
section g electrical specifications cy8c22xxx preliminary data sheet 290 document no. 38-12009 rev. *d december 22, 2003 dc operational amplifier specifications the following tables list guaranteed maximum and minimum specifications for the voltage and temperature ranges: 4.75v to 5.25v and -40 c t a 85 c, or 3.0v to 3.6v and -40 c t a 85 c, respectively. typical parameters apply to 5v and 3.3v at 25 c and are for design guidance only or unless otherwise specified. the operational amplifier is a component of both the analog continuous time psoc blocks and the analog switched cap psoc blocks. the guaranteed specifications are measured in the analog continuous time psoc block. typical parameters apply to 5v at 25 c and are for design guidance only. 5v dc operational amplifier specifications symbol description min typ max units notes v osoa input offset voltage (absolute value) low power input offset voltage (absolute value) mid power input offset voltage (absolute value) high power ?1.6 1.3 1.2 10 8 7.5 mv mv mv ? ? tcv osoa average input offset voltage drift ? 7.0 35.0 v/ o c i eboa input leakage current (port 0 analog pins) ? 20 ? pa gross tested to 1 a. c inoa input capacitance (port 0 analog pins) ? 4.5 9.5 pf package and pin dependent. temp = 25 o c. v cmoa common mode voltage range common mode voltage range (high power or high opamp bias) 0.0 ? vdd vdd-0.5 v the common-mode input voltage range is measured through an analog output buffer. the specification includes the limitations imposed by the characteristics of the analog output buffer. 0.5 ? g oloa open loop gain power=low power=medium power=high 60 60 80 ? ? db specification is applicable at high power. for all other bias modes (except high power, high opamp bias), minimum is 60 db. v ohighoa high output voltage swing (worst case internal load) power=low power=medium power=high vdd-0.2 vdd-0.2 vdd-0.5 ? ? ? ? ? ? v v v v olowoa low output voltage swing (worst case internal load) power=low power=medium power=high ? ? ? ? ? ? 0.2 0.2 0.5 v v v i soa supply current (including associated agnd buffer) power=low power=low, opamp bias=high power=medium power=medium, opamp bias=high power=high power=high, opamp bias=high ? ? ? ? ? ? 150 300 600 1200 2400 4600 200 400 800 1600 3200 6400 a a a a a a psrr oa supply voltage rejection ratio 60 ? ? db
december 22, 2003 document no. 38-12009 rev. *d 291 cy8c22xxx preliminary data sheet section g electrical specifications 3.3v dc operational amplifier specifications symbol description min typ max units notes v osoa input offset voltage (absolute value) low power input offset voltage (absolute value) mid power high power is 5 volt only ? ? 1.65 1.32 10 8 mv mv tcv osoa average input offset voltage drift ? 7.0 35.0 v/ o c i eboa input leakage current (port 0 analog pins) ? 20 ? pa gross tested to 1 a. c inoa input capacitance (port 0 analog pins) ? 4.5 9.5 pf package and pin dependent. temp = 25 o c. v cmoa common mode voltage range 0.2 ? vdd-0.2 v the common-mode input voltage range is measured through an analog output buffer. the specification includes the limitations imposed by the characteristics of the ana- log output buffer. g oloa open loop gain power=low power=medium power=high 60 60 80 ? ? db specification is applicable at high power. for all other bias modes (except high power, high opamp bias), minimum is 60 db. v ohighoa high output voltage swing (worst case internal load) power=low power=medium power=high is 5v only vdd-0.2 vdd-0.2 vdd-0.2 ? ? ? ? ? ? v v v v olowoa low output voltage swing (worst case internal load) power=low power=medium power=high ? ? ? ? ? ? 0.2 0.2 0.2 v v v i soa supply current (including associated agnd buffer) power=low power=low, opamp bias=high power=medium power=medium, opamp bias=high power=high power=high, opamp bias=high ? ? ? ? ? ? 150 300 600 1200 2400 4600 200 400 800 1600 3200 6400 a a a a a a psrr oa supply voltage rejection ratio 50 ? ? db
section g electrical specifications cy8c22xxx preliminary data sheet 292 document no. 38-12009 rev. *d december 22, 2003 dc analog output buffer specifications the following tables list guaranteed maximum and minimum specifications for the voltage and temperature ranges: 4.75v to 5.25v and -40 c t a 85 c, or 3.0v to 3.6v and -40 c t a 85 c, respectively. typical parameters apply to 5v and 3.3v at 25 c and are for design guidance only or unless otherwise specified. 5v dc analog output buffer specifications symbol description min typ max units notes v osob input offset voltage (absolute value) ? 3 12 mv tcv osob average input offset voltage drift ? +6 ? v/c v cmob common-mode input voltage range .5 ? vdd - 1.0 v r outob output resistance power = low power = high ? ? 1 1 ? ? ? ? v ohighob high output voltage swing (load = 32 ohms to vdd/2) power = low power = high .5 x vdd + 1.1 .5 x vdd + 1.1 ? ? ? ? v v v olowob low output voltage swing (load = 32 ohms to vdd/2) power = low power = high ? ? ? ? .5 x vdd - 1.3 .5 x vdd - 1.3 v v i sob supply current including bias cell (no load) power = low power = high ? ? 1.1 2.6 5.1 8.8 ma ma psrr ob supply voltage rejection ratio 60 ? ? db 3.3v dc analog output buffer specifications symbol description min typ max units notes v osob input offset voltage (absolute value) ? 3 12 mv tcv osob average input offset voltage drift ? +6 ? v/c v cmob common-mode input voltage range .5 - vdd - 1.0 v r outob output resistance power = low power = high ? ? 1 1 ? ? ? ? v ohighob high output voltage swing (load = 1k ohms to vdd/2) power = low power = high .5 x vdd + 1.0 .5 x vdd + 1.0 ? ? ? ? v v v olowob low output voltage swing (load = 1k ohms to vdd/2) power = low power = high ? ? ? ? .5 x vdd - 1.0 .5 x vdd - 1.0 v v i sob supply current including bias cell (no load) power = low power = high ? 0.8 2.0 2.0 4.3 ma ma psrr ob supply voltage rejection ratio 50 ? ? db
december 22, 2003 document no. 38-12009 rev. *d 293 cy8c22xxx preliminary data sheet section g electrical specifications dc analog reference specifications the following tables list guaranteed maximum and minimum specifications for the voltage and temperature ranges: 4.75v to 5.25v and -40 c t a 85 c, or 3.0v to 3.6v and -40 c t a 85 c, respectively. typical parameters apply to 5v and 3.3v at 25 c and are for design guidance only or unless otherwise specified. the guaranteed specifications are measured through the analog continuous time psoc blocks. the power levels for agnd refer to the power of the analog continuous time psoc block. the power levels for refhi and reflo refer to the analog ref- erence control register. the limits stated for agnd include the offset error of the agnd buffer local to the analog continuous time psoc block. dc analog psoc block specifications the following table lists guaranteed maximum and minimum specifications for the voltage and temperature ranges: 4.75v to 5.25v and -40 c t a 85 c, or 3.0v to 3.6v and -40 c t a 85 c, respectively. typical parameters apply to 5v and 3.3v at 25 c and are for design guidance only or unless otherwise specified. 5v dc analog reference specifications symbol description min typ max units ? agnd = vdd/2 a ct block power = high a. agnd tolerance includes the offsets of the local buffer in the psoc block. bandgap voltage is 1.3v 2%. vdd/2 - 0.043 vdd/2 - 0.025 vdd/2 + 0.003 v 3.3v dc analog reference specifications symbol description min typ max units ? agnd = vdd/2 a ct block power = high a. agnd tolerance includes the offsets of the local buffer in the psoc block. bandgap voltage is 1.3v 2% vdd/2 - 0.037 vdd/2 - 0.020 vdd/2 + 0.002 v dc analog psoc block specifications symbol description min typ max units notes r ct resistor unit value (continuous time) ? 12.24 ? k ? c sc capacitor unit value (switch cap) ? 80 ? ff
section g electrical specifications cy8c22xxx preliminary data sheet 294 document no. 38-12009 rev. *d december 22, 2003 dc por and lvd specifications the following table lists guaranteed maximum and minimum specifications for the voltage and temperature ranges: 4.75v to 5.25v and -40 c t a 85 c, or 3.0v to 3.6v and -40 c t a 85 c, respectively. typical parameters apply to 5v and 3.3v at 25 c and are for design guidance only or unless otherwise specified. dc por and lvd specifications symbol description min typ max units notes v ipor avdd value for ipor trip 1.60 1.90 2.30 v v ppor0r v ppor1r v ppor2r avdd value for ppor trip (positive ramp) porlev1,porlev0=00b porlev1,porlev0=01b porlev1,porlev0=10b ? 2.908 4.394 4.548 ? v v v v ppor0 v ppor1 v ppor2 avdd value for ppor trip (negative ramp) porlev1,porlev0=00b porlev1,porlev0=01b porlev1,porlev0=10b ? 2.816 4.394 4.548 ? v v v v ph0 v ph1 v ph2 ppor hysteresis porlev1,porlev0=00b porlev1,porlev0=01b porlev1,porlev0=10b ? ? ? 92 0 0 ? ? ? mv mv mv v lvd0 v lvd1 v lvd2 v lvd3 v lvd4 v lvd5 v lvd6 v lvd7 avdd value for lvd trip vm2,vm1,vm0=000b vm2,vm1,vm0=001b vm2,vm1,vm0=010b vm2,vm1,vm0=011b vm2,vm1,vm0=100b vm2,vm1,vm0=101b vm2,vm1,vm0=110b vm2,vm1,vm0=111b 2.863 2.963 3.070 3.920 4.393 4.550 4.632 4.718 2.921 3.023 3.133 4.00 4.483 4.643 4.727 4.814 2.979 a 3.083 3.196 4.080 4.573 4.736 b 4.822 4.910 a. always greater than 50 mv above ppor (porlev=00) for falling supply. b. always greater than 50 mv above ppor (porlev=10) for falling supply. v v v v v v v v v
december 22, 2003 document no. 38-12009 rev. *d 295 cy8c22xxx preliminary data sheet section g electrical specifications dc programming specifications the following table lists guaranteed maximum and minimum specifications for the voltage and temperature ranges: 4.75v to 5.25v and -40 c t a 85 c, or 3.0v to 3.6v and -40 c t a 85 c, respectively. typical parameters apply to 5v and 3.3v at 25 c and are for design guidance only or unless otherwise specified. dc programming specifications symbol description min typ max units notes i ccp supply current during programming or verify ? 5 25 ma v ilp input low voltage during programming or verify ? ? 0.8 v v ihp input high voltage during programming or verify 2.2 ? ? v i ilp input current when applying vilp to p1[0] or p1[1] during programming or verify ? ? 0.2 ma driving internal pull-down resistor. i ihp input current when applying vihp to p1[0] or p1[1] during programming or verify ? ? 1.5 ma driving internal pull-down resistor. v olv output low voltage during programming or verify ? ? vss+0.75 v v ohv output high voltage during programming or verify vdd - 1.0 ? vdd v flash enpb flash endurance (per block) 50,000 ? ? ? erase/write cycles per block. flash ent flash endurance (total) a a. a maximum of 36 x 50,000 block endurance cycles is allowed. this may be balanced between operations on 36x1 blocks of 50,000 maximum cycles each, 36x2 blocks of 25,000 maximum cycles each, or 36x4 blocks of 12,500 maximum cycles each (and so forth to limit the total number of c ycles to 36x50,000 and that no single block ever sees more than 50,000 cycles). the psoc devices use an adaptive algorithm to enhance endurance over the industrial temperature range (-40c to +85c ambient). any temperature range within a 50c span between 0c and 85c is considered constant with respect to endurance enhancements. for instance, if room temperatu re (25c) is the nominal operating temperature, then the range from 0c to 50c can be approximated by the constant value 25 and a temperature sensor is not needed. for the full industrial range, the user must employ a temperature sensor user module (flashtemp) and feed the result to the tem perature argument before writing. refer to the flash apis application note an2015 at http://www.cypress.com under application notes for more information. 1,800,000 ? ? ? erase/write cycles. flash dr flash data retention 10 ? ? years
section g electrical specifications cy8c22xxx preliminary data sheet 296 document no. 38-12009 rev. *d december 22, 2003 ac electrical characteristics ac chip-level specifications the following table lists guaranteed maximum and minimum specifications for the voltage and temperature ranges: 4.75v to 5.25v and -40 c t a 85 c, or 3.0v to 3.6v and -40 c t a 85 c, respectively. typical parameters apply to 5v and 3.3v at 25 c and are for design guidance only or unless otherwise specified. ac general purpose io (gpio) specifications the following table lists guaranteed maximum and minimum specifications for the voltage and temperature ranges: 4.75v to 5.25v and -40 c t a 85 c, or 3.0v to 3.6v and -40 c t a 85 c, respectively. typical parameters apply to 5v and 3.3v at 25 c and are for design guidance only or unless otherwise specified. ac chip-level specifications symbol description min typ max units notes f imo internal main oscillator frequency 23.4 24 24.6 a,c mhz trimmed. utilizing factory trim values. f cpu1 cpu frequency (5 v nominal) 0.93 24 24.6 a,b a. 4.75v < vdd < 5.25v. b. accuracy derived from internal main oscillator with appropriate trim for vdd range. mhz f cpu2 cpu frequency (3.3v nominal) 0.93 12 12.3 b,c c. 3.0v < vdd < 3.6v. mhz f 48m digital psoc block frequency 0 48 49.2 a,b,d d. see application note an2012 ?adjusting psoc microcontroller trims for dual voltage-range operation? for information on maximu m frequency for user modules. mhz refer to the ac digital block specifica- tions below. f 24m digital psoc block frequency 0 24 24.6 b,e,d e. 3.0v < 5.25v. mhz f 32k1 internal low speed oscillator frequency 15 32 64 khz f 32k2 external crystal oscillator ? 32.768 ? khz accuracy is capacitor and crystal depen- dent. 50% duty cycle. f pll pll frequency ? 23.986 ? mhz is a multiple (x732) of crystal frequency. jitter24m2 24 mhz period jitter (pll) 600 ? ps t pllslew pll lock time 0.5 ? 10 ms t pllslews- low pll lock time for low gain setting 0.5 ? 50 ms t os external crystal oscillator startup to 1% ? 1700 2620 ms t osacc external crystal oscillator startup to 100 ppm ? 2800 3800 f f. the crystal oscillator frequency is within 100 ppm of its final value by the end of the t osacc period. correct operation assumes a properly loaded 1 uw maximum drive level 32.768 khz crystal. 3.0v vdd 5.5v, -40 o c t a 85 o c. ms jitter32k 32 khz period jitter ? 100 ns t xrst external reset pulse width 10 ? ? s dc24m 24 mhz duty cycle 40 50 60 % step24m 24 mhz trim step size ? 50 ? khz fout48m 48 mhz output frequency 46.8 48.0 49.2 a,c mhz trimmed. utilizing factory trim values. jitter24m1 24 mhz period jitter (imo) ? 600 ps f max maximum frequency of signal on row input or row out- put. ? ? 12 mhz t ramp supply ramp time 0 ? ? s ac gpio specifications symbol description min typ max units notes f gpio gpio operating frequency 0 ? 12 mhz trisef rise time, normal strong mode, cload = 50 pf 3 ? 18 ns vdd = 4.5 to 5.5v, 10% - 90% tfallf fall time, normal strong mode, cload = 50 pf 2 ? 18 ns vdd = 4.5 to 5.5v, 10% - 90% trises rise time, slow strong mode, cload = 50 pf 10 27 ? ns vdd = 3 to 5.5v, 10% - 90% tfalls fall time, slow strong mode, cload = 50 pf 10 22 ? ns vdd = 3 to 5.5v, 10% - 90%
december 22, 2003 document no. 38-12009 rev. *d 297 cy8c22xxx preliminary data sheet section g electrical specifications ac operational amplifier specifications the following tables list guaranteed maximum and minimum specifications for the voltage and temperature ranges: 4.75v to 5.25v and -40 c t a 85 c, or 3.0v to 3.6v and -40 c t a 85 c, respectively. typical parameters apply to 5v and 3.3v at 25 c and are for design guidance only or unless otherwise specified. settling times, slew rates, and gain bandwidth are based on the analog continuous time psoc block. 5v ac operational amplifier specifications symbol description min typ max units notes t roa rising settling time from 80% of ? v to 0.1% of ? v (10 pf load, unity gain) power = low power = low, opamp bias = high power = medium power = medium, opamp bias = high power = high power = high, opamp bias = high ? ? ? ? ? ? ? ? ? 3.9 0.72 0.62 s s s s s s specification maximums for low power and high opamp bias, medium power, and medium power and high opamp bias lev- els are between low and high power lev- els. t soa falling settling time from 20% of ? v to 0.1% of ? v (10 pf load, unity gain) power = low power = low, opamp bias = high power = medium power = medium, opamp bias = high power = high power = high, opamp bias = high ? ? ? ? ? ? ? ? ? 5.9 0.92 0.72 s s s s s s specification maximums for low power and high opamp bias, medium power, and medium power and high opamp bias lev- els are between low and high power lev- els. sr roa rising slew rate (20% to 80%)(10 pf load, unity gain) power = low power = low, opamp bias = high power = medium power = medium, opamp bias = high power = high power = high, opamp bias = high 0.15 1.7 6.5 ? ? ? v/ s v/ s v/ s v/ s v/ s v/ s specification minimums for low power and high opamp bias, medium power, and medium power and high opamp bias lev- els are between low and high power lev- els. sr foa falling slew rate (20% to 80%)(10 pf load, unity gain) power = low power = low, opamp bias = high power = medium power = medium, opamp bias = high power = high power = high, opamp bias = high 0.01 0.5 4.0 ? ? ? v/ s v/ s v/ s v/ s v/ s v/ s specification minimums for low power and high opamp bias, medium power, and medium power and high opamp bias lev- els are between low and high power lev- els. bw oa gain bandwidth product power = low power = low, opamp bias = high power = medium power = medium, opamp bias = high power = high power = high, opamp bias = high 0.75 3.1 5.4 ? ? ? mhz mhz mhz mhz mhz mhz specification minimums for low power and high opamp bias, medium power, and medium power and high opamp bias lev- els are between low and high power lev- els. e noa noise at 1 khz ? 200 ? nv/rt-hz
section g electrical specifications cy8c22xxx preliminary data sheet 298 document no. 38-12009 rev. *d december 22, 2003 3.3v ac operational amplifier specifications symbol description min typ max units notes t roa rising settling time from 80% of ? v to 0.1% of ? v (10 pf load, unity gain) power = low power = low, opamp bias = high power = medium power = medium, opamp bias = high power = high (3.3 volt high bias operation not sup- ported) power = high, opamp bias = high (3.3 volt high power, high opamp bias not supported) ? ? ? ? ? ? ? ? ? ? 3.92 0.72 ? ? s s s s s s specification maximums for low power and high opamp bias, medium power, and medium power and high opamp bias lev- els are between low and high power lev- els. t soa falling settling time from 20% of ? v to 0.1% of ? v (10 pf load, unity gain) power = low power = low, opamp bias = high power = medium power = medium, opamp bias = high power = high (3.3 volt high bias operation not sup- ported) power = high, opamp bias = high (3.3 volt high power, high opamp bias not supported) ? ? ? ? ? ? ? ? ? ? 5.41 0.72 ? ? s s s s s s specification maximums for low power and high opamp bias, medium power, and medium power and high opamp bias lev- els are between low and high power lev- els. sr roa rising slew rate (20% to 80%)(10 pf load, unity gain) power = low power = low, opamp bias = high power = medium power = medium, opamp bias = high power = high (3.3 volt high bias operation not sup- ported) power = high, opamp bias = high (3.3 volt high power, high opamp bias not supported) 0.31 2.7 ? ? ? ? ? ? ? ? v/ s v/ s v/ s v/ s v/ s v/ s specification minimums for low power and high opamp bias, medium power, and medium power and high opamp bias lev- els are between low and high power lev- els. sr foa falling slew rate (20% to 80%)(10 pf load, unity gain) power = low power = low, opamp bias = high power = medium power = medium, opamp bias = high power = high (3.3 volt high bias operation not sup- ported) power = high, opamp bias = high (3.3 volt high power, high opamp bias not supported) 0.24 1.8 ? ? ? ? ? ? ? ? v/ s v/ s v/ s v/ s v/ s v/ s specification minimums for low power and high opamp bias, medium power, and medium power and high opamp bias lev- els are between low and high power lev- els. bw oa gain bandwidth product power = low power = low, opamp bias = high power = medium power = medium, opamp bias = high power = high (3.3 volt high bias operation not sup- ported) power = high, opamp bias = high (3.3 volt high power, high opamp bias not supported) 0.67 2.8 ? ? ? ? ? ? ? ? mhz mhz mhz mhz mhz mhz specification minimums for low power and high opamp bias, medium power, and medium power and high opamp bias lev- els are between low and high power lev- els. e noa noise at 1 khz (turbo medium) ? 200 ? nv/rt-hz
december 22, 2003 document no. 38-12009 rev. *d 299 cy8c22xxx preliminary data sheet section g electrical specifications ac digital block specifications the following table lists guaranteed maximum and minimum specifications for the voltage and temperature ranges: 4.75v to 5.25v and -40 c t a 85 c, or 3.0v to 3.6v and -40 c t a 85 c, respectively. typical parameters apply to 5v and 3.3v at 25 c and are for design guidance only or unless otherwise specified. ac digital block specifications function description min typ max units notes timer capture pulse width 50 a a. 50 ns minimum input pulse width is based on the input synchronizers running at 24 mhz (42 ns nominal period). ? ? ns maximum frequency, no capture ? ? 48 mhz 4.75v < vdd < 5.25v. maximum frequency, with capture ? ? 24 mhz counter enable pulse width 50 a ? ? ns maximum frequency, no enable input ? ? 48 mhz 4.75v < vdd < 5.25v. maximum frequency, enable input ? ? 24 mhz dead band kill pulse width: asynchronous restart mode 20 ? ? ns synchronous restart mode 50 a ? ? ns disable mode 50 a ? ? ns maximum frequency ? ? 48 mhz 4.75v < vdd < 5.25v. crcprs (prs mode) maximum input clock frequency ? ? 48 mhz 4.75v < vdd < 5.25v. crcprs (crc mode) maximum input clock frequency ? ? 24 mhz spim maximum input clock frequency ? ? 8 mhz spis maximum input clock frequency ? ? 4 ns width of ss_ negated between transmissions 50 a ? ? ns transmitter maximum input clock frequency ? ? 16 mhz receiver maximum input clock frequency ? 16 48 mhz 4.75v < vdd < 5.25v.
section g electrical specifications cy8c22xxx preliminary data sheet 300 document no. 38-12009 rev. *d december 22, 2003 ac analog output buffer specifications the following tables list guaranteed maximum and minimum specifications for the voltage and temperature ranges: 4.75v to 5.25v and -40 c t a 85 c, or 3.0v to 3.6v and -40 c t a 85 c, respectively. typical parameters apply to 5v and 3.3v at 25 c and are for design guidance only or unless otherwise specified. 5v ac analog output buffer specifications symbol description min typ max units notes t rob rising settling time to 0.1%, 1v step, 100pf load power = low power = high ? ? ? ? 2.5 2.5 s s t sob falling settling time to 0.1%, 1v step, 100pf load power = low power = high ? ? ? ? 2.2 2.2 s s sr rob rising slew rate (20% to 80%), 1v step, 100pf load power = low power = high 0.65 0.65 ? ? ? ? v/ s v/ s sr fob falling slew rate (80% to 20%), 1v step, 100pf load power = low power = high 0.65 0.65 ? ? ? ? v/ s v/ s bw ob small signal bandwidth, 20mv pp , 3db bw, 100pf load power = low power = high 0.8 0.8 ? ? ? ? mhz mhz bw ob large signal bandwidth, 1v pp , 3db bw, 100pf load power = low power = high 300 300 ? ? ? ? khz khz 3.3v ac analog output buffer specifications symbol description min typ max units notes t rob rising settling time to 0.1%, 1v step, 100pf load power = low power = high ? ? ? ? 3.8 3.8 s s t sob falling settling time to 0.1%, 1v step, 100pf load power = low power = high ? ? ? ? 2.6 2.6 s s sr rob rising slew rate (20% to 80%), 1v step, 100pf load power = low power = high .5 .5 ? ? ? ? v/ s v/ s sr fob falling slew rate (80% to 20%), 1v step, 100pf load power = low power = high .5 .5 ? ? ? ? v/ s v/ s bw ob small signal bandwidth, 20mv pp , 3db bw, 100pf load power = low power = high 0.7 0.7 ? ? ? ? mhz mhz bw ob large signal bandwidth, 1v pp , 3db bw, 100pf load power = low power = high 200 200 ? ? ? ? khz khz
december 22, 2003 document no. 38-12009 rev. *d 301 cy8c22xxx preliminary data sheet section g electrical specifications ac external clock specifications the following tables list guaranteed maximum and minimum specifications for the voltage and temperature ranges: 4.75v to 5.25v and -40 c t a 85 c, or 3.0v to 3.6v and -40 c t a 85 c, respectively. typical parameters apply to 5v and 3.3v at 25 c and are for design guidance only or unless otherwise specified. ac programming specifications the following table lists guaranteed maximum and minimum specifications for the voltage and temperature ranges: 4.75v to 5.25v and -40 c t a 85 c, or 3.0v to 3.6v and -40 c t a 85 c, respectively. typical parameters apply to 5v and 3.3v at 25 c and are for design guidance only or unless otherwise specified. 5v ac external clock specifications symbol description min typ max units notes f oscext frequency 0 ?24.24mhz ? high period 20.6 ? ?ns ? low period 20.6 ? ?ns ? power up imo to switch 150 ? ? s 3.3v ac external clock specifications symbol description min typ max units notes f oscext frequency with cpu clock divide by 1 a a. maximum cpu frequency is 12 mhz at 3.3v. with the cpu clock divider set to 1, the external clock must adhere to the maximum f requency and duty cycle require- ments. 0 ?12mhz f oscext frequency with cpu clock divide by 2 or greater b b. if the frequency of the external clock is greater than 12 mhz, the cpu clock divider must be set to 2 or greater. in this cas e, the cpu clock divider will ensure that the fifty percent duty cycle requirement is met. 0 ?24mhz ? high period with cpu clock divide by 1 41.7 ? ?ns ? low period with cpu clock divide by 1 41.7 ? ?ns ? power up imo to switch 150 ? ? s ac programming specifications symbol description min typ max units notes t rsclk rise time of sclk 1 ? 20 ns t fsclk fall time of sclk 1 ? 20 ns t ssclk data set up time to falling edge of sclk 40 ? ? ns t hsclk data hold time from falling edge of sclk 40 ? ? ns f sclk frequency of sclk 0 ? 8 mhz t eraseb flash erase time (block) ? 15 ? ms t write flash block write time ? 30 ? ms t dsclk data out delay from falling edge of sclk ? ? 45 ns
section g electrical specifications cy8c22xxx preliminary data sheet 302 document no. 38-12009 rev. *d december 22, 2003 ac i 2 c specifications the following table lists guaranteed maximum and minimum specifications for the voltage and temperature ranges: 4.75v to 5.25v and -40 c t a 85 c, or 3.0v to 3.6v and -40 c t a 85 c, respectively. typical parameters apply to 5v and 3.3v at 25 c and are for design guidance only or unless otherwise specified. definition for timing for f/s-mode on the i 2 c bus ac characteristics of the i 2 c sda and scl pins symbol description standard mode fast mode units notes min max min max f scli2c scl clock frequency 0 100 0 400 khz t hdstai2c hold time (repeated) start condition. after this period, the first clock pulse is generated. 4.0 ?0.6 ? s t lowi2c low period of the scl clock 4.7 ?1.3 ? s t highi2c high period of the scl clock 4.0 ?0.6 ? s t sustai2c set-up time for a repeated start condition 4.7 ?0.6 ? s t hddati2c data hold time 0 ?0 ? s t sudati2c data set-up time 250 ? 100 a a. a fast-mode i 2 c-bus device can be used in a standard-mode i 2 c-bus system, but the requirement t su;dat 250 ns must then be met. this will automatically be the case if the device does not stretch the low period of the scl signal. if such device does stretch the low period of the scl signal, it must output the next data bit to the sda line t rmax + t su;dat = 1000 + 250 = 1250 ns (according to the standard-mode i 2 c-bus specification) before the scl line is released. ?ns t sustoi2c set-up time for stop condition 4.0 ?0.6 ? s t bufi2c bus free time between a stop and start condition 4.7 ?1.3 ? s t spi2c pulse width of spikes are suppressed by the input fil- ter. ? ?050ns sda scl s sr s p t bufi2c t spi2c t hdstai2c t sustoi2c t sustai2c t lowi2c t highi2c t hddati2c t hdstai2c t sudati2c
december 22, 2003 document no. 38-12009 rev. *d 303 section h revision history document revision history document title : cy8c22113, cy8c22213 psoc? mixed signal array preliminary data sheet document number : 38-12009 revision ecn # issue date origin of change description of change ** 128180 06/30/2003 new silicon. new document ? advanced data sheet (two page product brief). *a 129202 09/16/2003 nwj new document ? preliminary data sheet (300 page product detail). *b 130127 10/15/2003 nwj revised document for silicon revision a. *c 131679 12/05/2003 nwj changes to electrical specifications section, miscellaneous changes to i2c, gdi, rdi, reg- isters, and digital block chapters. *d 131803 12/22/2003 nwj changes to electrical specifications and mis- cellaneous small changes throughout the data sheet. distribution : external/public posting : none
section h revision history cy8c22xxx preliminary data sheet 304 document no. 38-12009 rev. *d december 22, 2003


▲Up To Search▲   

 
Price & Availability of CY8C22213-24PVIT

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X